Default in most terminal you can press ctrl\ to send a SIGQUIT signal to the process.

However on my keyboard to type a backslash, you have to do it like this: altshift7

Doing ctrlaltshift7 doesn't work, so how should I do the keyboard shortcut?

  • Can you not rebind the shortcut to be something you can type simply?
    – Xyon
    Nov 15, 2012 at 12:49
  • What keyboard is that?
    – week
    Nov 15, 2012 at 12:53
  • @week Danish OSX keyboard.
    – Tyilo
    Nov 15, 2012 at 13:48

6 Answers 6


I had to figure out the exact same thing today, with a German keyboard and in Ubuntu. So I've come up with the script below. Finding the right key still needs trial and error, but it's pretty simple that way.

For the record, Ctrl-4 did the trick in my case.


# Shows character codes while typing. More to the point, it also captures signals.

# Trap function
sig() {
    printf '\t\t\t%s\t(re-enabled now, works next time)\n' "$1"
    # A trap disables itself after being called once.
    trap - $1

# Setting traps for all signals
mapfile -t signals < <(trap -l | grep -Eo SIG[-+A-Z0-9]+)

for signal in "${signals[@]}"; do
    trap "sig $signal" "$signal"

# Display characters
printf "Start typing to examine characters and signals. Exit with Ctrl-C (twice).\n\n"
printf "Char\tDec\t Hex\tSignal\n"

while IFS= read -rN 1 char; do 
    LC_CTYPE=C printf '\t%3d\t0x%02X\n' "'$char" "'$char"
  • 2
    Thanks for posting, ctrl+4 works for me on ubuntu with a german keyboard as well.
    – hakre
    Feb 9, 2021 at 13:31
  • 1
    Ctrl-4 worked for me with Swedish layout as well, thanks.
    – user93927
    Mar 16, 2021 at 18:51

I don’t know how you can type Ctrl+\, but I can give you an alternative way to generate SIGQUIT from the keyboard.  Find a character that you can type as a simple key combination.  This probably needs to map to a (single) ASCII character (i.e., a single byte); e.g., Ctrl+A.  Then type

stty quit ^A

That can be either sttyquitCtrl+A Enter (if you get an error message, try typing Ctrl+V before the Ctrl+A) or literally sttyquit^AEnter (if you get an error message, try putting the ^A in quotes).  Then type a command like sleep 9, press your key combination (i.e., Ctrl+A), and see whether the program quits as you would expect for Ctrl+\.

If you find a combination that works, put it (the stty quit command) into your .login, .profile, .bashrc, or whatever initialization command file you use.


I had almost the same problem with a french "azerty" keyboard.

To get the backslash character \, I have to press altshift/.

But pressing ctrlaltshift/ does not send any signal, it just inserts a dot . in the Terminal.

I found that pressing ctrl` (the backtick or backquote key) does send the SIGQUIT signal:

$ sleep 9
^\Quit: 3

Pressing ctrlshift` also works.

Note that, on a french keyboard, "shifting" the backtick character (i.e. pressing shift`) produces the Pound sign £.

You can get the list of all signals with the kill -l command:

$ kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT  4) SIGILL
 5) SIGTRAP      6) SIGABRT      7) SIGEMT   8) SIGFPE
 9) SIGKILL     10) SIGBUS      11) SIGSEGV 12) SIGSYS
13) SIGPIPE     14) SIGALRM     15) SIGTERM 16) SIGURG
21) SIGTTIN     22) SIGTTOU     23) SIGIO   24) SIGXCPU
29) SIGINFO     30) SIGUSR1     31) SIGUSR2 
  • Thanks, ctrl + ` is the only way to exit an Elixir shell with only one shortcut on a french MacOS keyboard. Jun 6, 2020 at 22:24

With my German keyboard, ctr+4 sends a ctr \


Have you tried mapping a different key to ^\?

For instance (in macOS terminal):

Go to “Terminal -> Preferences -> Settings -> Keyboard”, click the + and map something like control+f4 to \034.

  • <kbd>ctrl</kbd><kbd>4</kbd> just results in the 4 being typed.
    – Tyilo
    Nov 15, 2012 at 13:49
  • kbd tag doesn't work in the comments. use the backquote instead. Ctrl + 4
    – pratnala
    Nov 15, 2012 at 17:04

Ctrl-\ is likely to generate ASCII code 28. Try doing something else that sends ASCII code 28.

For instance, maybe try this: hold down Alt, and then pressing 2 on the numpad, and then 8 on the numpad, and then releasing the Alt key. (Granted, if you have troubles hitting backslash, maybe you have troubles using numpad keys.) I don't have a Mac by me, but that works on many Unix-ish systems (and DOS/Microsoft Windows), so may be worth giving a shot.

If you are interacting with a remote system, you could put the character in a file and then some terminal software would let you use an "ASCII upload" to send the keystroke.

Another possible resource: AppleScript: sending keys for OSX

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .