Some things won't respond to Ctrl+C; in that case, you can also do Ctrl+Z which stops the process and then kill %1 - or even fg to go back to it. Read the section in man bash entitled "JOB CONTROL" for more information. It's very helpful. (If you're not familiar with man or the man pager, you can search using /. man bash then inside it /JOB CONTROLEnter will start searching, n will find the next match which is the right section.)

Answer from Chris Morgan on Stack Overflow
🌐
Linux Kernel Labs
linux-kernel-labs.github.io › refs › heads › master › lectures › interrupts.html
Interrupts — The Linux Kernel documentation
(void *) 0xc15de780 <entry_SYSENTER_32> ... + 8 * 128) monitor info registers · In Linux the interrupt handling is done in three phases: critical, immediate and deferred....
Top answer
1 of 2
2

The command stty -a will show you all keyboard shortcuts in your current terminal. Generally in Unix-like systems, the only signals mapped are Ctrl+C (SIGINT), Ctrl+\ (SIGQUIT), and Ctrl+Z (SIGTSTP). There are no other bindings to other signals, and therefore no other signals that you can send within your current session with the keyboard.

Generally speaking, the final d in a program's name usually indicates "daemon". Daemons are intended to run in background and operate through other means beyond stdin/out (like pipes, signals, sockets...). That means that it could be that you get unexpected behavior when the program itself is not running in background (like the terminal seems to "hang", because the daemon has done something to the input, output, or it's doing something/waiting in a loop)

Also generally, it could be as well that the daemon has traps for specific signals and handles them differently (or even ignores them). Have you tried to send SIGINT (kill -2, equivalent to Ctrl+C), SIGQUIT (kill -3, equivalent to Ctrl+\), or SIGTSTP (kill -20, equivalent to Ctrl+Z) while running mysqld in background, just for testing purposes?

EDIT: To change stty mappings, you'll need to write:

stty <action> <new-mapping>

For example, to remap SIGINT to Ctrl+X

stty intr ^x

Note that this setting is only valid in the current terminal during the current session.

2 of 2
0

Ctrl+Z is actually a feature of the generic terminal interface in the kernel, not of bash. It causes a SIGTSTP signal to be sent to the foreground process. Likewise Ctrl+C sends SIGTERM and Ctrl+\ sends SIGQUIT.

There are two ways in which a program can cause Ctrl+Z to lose its effect.

  • The program can ignore the SIGTSTP signal.
    You can check the a process's signal behavior with a debugger. On Linux, the information is available via /proc: grep Sig /proc/1234/status where 1234 is the process ID shows which signals are ignored (SigIgn, they'll just bounced off harmlessly) or blocked (SigBlk, they're put in wait until the program lets them in). The number is a bitmask and written out in hexadecimal. SIGTSTP is signal 20 (run kill -l in bash) so it is ignored if on the SigIgn line, the fifth digit from the right is 8 or above.
  • The program can change the key bindings.
    You can check the current key bindings with a command line like stty -a </dev/pts/42 where /dev/pts/42 is the terminal where the process is running. Look for susp = ^Z.

A daemon is likely to ignore most signals. Launch it in the background, if it doesn't fork by itself (most daemons actually fork a child as soon as they start and let the parent immediately). If you launched it in the foreground, there are many ways to recover (send it or its parent shell a signal) but you'll need another shell for that.

🌐
Medium
medium.com › @18bhavyasharma › command-working-behind-the-ctrl-c-and-ctrl-z-interrupt-signals-in-linux-c5d802f914f3
Command Working Behind the Ctrl+C and Ctrl+Z Interrupt Signals in Linux | by bhavya sharma | Medium
October 29, 2024 - They enable the kernel to communicate with running processes, and allow users to control these processes efficiently. Some common signals include: SIGINT (2): Interrupts a process (ctrl+c).
🌐
Opensource.com
opensource.com › article › 20 › 10 › linux-kernel-interrupts
How the Linux kernel handles interrupts | Opensource.com
October 5, 2020 - You can find more information about this in the Linux Foundation's article Intro to real-time Linux for embedded developers. Exceptions are the type of interrupt that you probably know about. When the CPU executes a command that would result in division by zero or a page fault, any additional execution is interrupted.
Top answer
1 of 2
15

As far as I know, the only signals that have a default keyboard shortcut in the shell are SIGINT (Ctrl + C) to stop a process and SIGTSTP (Ctrl + Z) to pause one.

Apparently, as Radu Rădeanu just taught me, there is also Ctrl+\ which is mapped to SIGQUIT.

You can find a list of all signals and what they do in man 7 signal:

   Signal     Value     Action   Comment
   ──────────────────────────────────────────────────────────────────────
   SIGHUP        1       Term    Hangup detected on controlling terminal
                                 or death of controlling process
   SIGINT        2       Term    Interrupt from keyboard
   SIGQUIT       3       Core    Quit from keyboard
   SIGILL        4       Core    Illegal Instruction
   SIGABRT       6       Core    Abort signal from abort(3)
   SIGFPE        8       Core    Floating point exception
   SIGKILL       9       Term    Kill signal
   SIGSEGV      11       Core    Invalid memory reference
   SIGPIPE      13       Term    Broken pipe: write to pipe with no
                                 readers
   SIGALRM      14       Term    Timer signal from alarm(2)

   SIGTERM      15       Term    Termination signal
   SIGUSR1   30,10,16    Term    User-defined signal 1
   SIGUSR2   31,12,17    Term    User-defined signal 2
   SIGCHLD   20,17,18    Ign     Child stopped or terminated
   SIGCONT   19,18,25    Cont    Continue if stopped
   SIGSTOP   17,19,23    Stop    Stop process
   SIGTSTP   18,20,24    Stop    Stop typed at terminal
   SIGTTIN   21,21,26    Stop    Terminal input for background process
   SIGTTOU   22,22,27    Stop    Terminal output for background process
   SIGBUS      10,7,10     Core    Bus error (bad memory access)
   SIGPOLL                 Term    Pollable event (Sys V).
                                   Synonym for SIGIO
   SIGPROF     27,27,29    Term    Profiling timer expired
   SIGSYS      12,31,12    Core    Bad argument to routine (SVr4)
   SIGTRAP        5        Core    Trace/breakpoint trap
   SIGURG      16,23,21    Ign     Urgent condition on socket (4.2BSD)
   SIGVTALRM   26,26,28    Term    Virtual alarm clock (4.2BSD)
   SIGXCPU     24,24,30    Core    CPU time limit exceeded (4.2BSD)
   SIGXFSZ     25,25,31    Core    File size limit exceeded (4.2BSD)

   SIGIOT         6        Core    IOT trap. A synonym for SIGABRT
   SIGEMT       7,-,7      Term
   SIGSTKFLT    -,16,-     Term    Stack fault on coprocessor (unused)
   SIGIO       23,29,22    Term    I/O now possible (4.2BSD)
   SIGCLD       -,-,18     Ign     A synonym for SIGCHLD
   SIGPWR      29,30,19    Term    Power failure (System V)
   SIGINFO      29,-,-             A synonym for SIGPWR
   SIGLOST      -,-,-      Term    File lock lost (unused)
   SIGWINCH    28,28,20    Ign     Window resize signal (4.3BSD, Sun)
   SIGUNUSED    -,31,-     Core    Synonymous with SIGSYS

You can see the signals that are available on your system with kill -l:

$ kill -l
 1) SIGHUP      2) SIGINT        3) SIGQUIT      4) SIGILL      5) SIGTRAP
 6) SIGABRT     7) SIGBUS        8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX    

Note that there are many SIGRTMAX and SIGRTMIN signals, the Linux kernel supports 32 different signals but the range of signals actually supported will depend on the glibc implementation on your system.

2 of 2
7

The SIGQUIT signal is similar to SIGINT (produced by Ctrl+C), except that it's controlled by a different key — the QUIT character, usually Ctrl+\ — and produces a core dump when it terminates the process, just like a program error signal. You can think of this as a program error condition "detected" by the user.

So, Ctrl+\ (Ctrl + Backslash) may be what you want.

Reference: Termination Signals.

Find elsewhere
🌐
O'Reilly
oreilly.com › library › view › understanding-the-linux › 0596005652 › ch04s06.html
4.6. Interrupt Handling - Understanding the Linux Kernel, 3rd Edition [Book]
November 17, 2005 - The _ _do_IRQ( ) function4.6.1.8. Reviving a lost interrupt4.6.1.9. Interrupt service routines4.6.1.10. Dynamic allocation of IRQ lines4.6.2.
Authors   Daniel P. BovetMarco Cesati
Published   2005
Pages   942
🌐
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › how to stop/interrupt cp or mv linux or unix command
How to stop/Interrupt cp or mv Linux or Unix command - nixCraft
August 16, 2017 - A user can stop or interrupt any command such as cp, mv and others by pressing CTRL–c (press and hold ctrl key followed by c) during the execution of a command or bash/perl/python script.
🌐
EmbeTronicX
embetronicx.com › tutorials › linux › device-drivers › linux-device-driver-tutorial-part-13-interrupt-example-program-in-linux-kernel
Interrupts Example Program in Linux Kernel – Linux Device Driver Tutorial - Part 13
September 24, 2023 - We can able to see the print “Shared IRQ: Interrupt Occurred“ ... If you are using the newer Linux kernel, then this may not work properly.
🌐
Montana
cs.montana.edu › courses › spring2005 › 518 › Hypertextbook › jim › media › interrupts_on_linux.pdf pdf
Linux Interrupts: The Basic Concepts Mika J. Järvenpää University of Helsinki
Handler: smp call function interrupt(). ... I/O APIC(s). It is also possible to share IRQs (capable to · handle more I/O devices than there are IRQ lines) in Linux.
🌐
Linux Journal
linuxjournal.com › content › watch-live-interrupts
Watch Live Interrupts | Linux Journal
June 22, 2009 - # watch -n1 "cat /proc/interrupts" CPU0 CPU1 0: 330 0 IO-APIC-edge timer 1: 11336 0 IO-APIC-edge i8042 4: 2 0 IO-APIC-edge 6: 3 0 IO-APIC-edge floppy ... NMI: 0 0 Non-maskable interrupts LOC: 5806923 6239132 Local timer interrupts ... The watch command executes another command periodically, ...
🌐
O'Reilly
oreilly.com › library › view › linux-device-drivers › 0596005903 › ch10.html
10. Interrupt Handling - Linux Device Drivers, 3rd Edition [Book]
February 7, 2005 - That way, of course, is interrupts. An interrupt is simply a signal that the hardware can send when it wants the processor’s attention. Linux handles interrupts in much the same way that it handles signals in user space. For the most part, a driver need only register a handler for its device’s interrupts, and handle them properly when they arrive.
Authors   Jonathan CorbetAlessandro Rubini
Published   2005
Pages   636
🌐
Baeldung
baeldung.com › home › processes › interrupt handling in linux
Interrupt Handling in Linux | Baeldung on Linux
March 19, 2025 - The Programmable Interrupt Controllers (PIC) are responsible for collecting the IRQ and determining the order for passing the interrupt signals to the processor. Each CPU has IRQ assigned, and the PIC listens to the IRQ. Recent Linux systems distribute the IRQ among the cores with the Advanced ...
🌐
The Geek Stuff
thegeekstuff.com › 2014 › 01 › linux-interrupts
Introduction to Linux Interrupts and CPU SMP Affinity
January 27, 2014 - Interrupts are signal that are sent across IRQ (Interrupt Request Line) by a hardware or software. Interrupts allow devices like keyboard, serial cards and parallel ports to indicate that it needs CPU attention. Once the CPU receives the Interrupt Request, CPU will temporarily stop execution of running program and invo
🌐
Linux Kernel Labs
linux-kernel-labs.github.io › refs › heads › master › labs › interrupts.html
I/O access and Interrupts — The Linux Kernel documentation
As with other resources, a driver must gain access to an interrupt line before it can use it and release it at the end of the execution. In Linux, the request to obtain and release an interrupt is done using the requests_irq() and free_irq() functions:
🌐
Alibaba Cloud Community
alibabacloud.com › blog › understanding-cpu-interrupts-in-linux_597128
Understanding CPU Interrupts in Linux - Alibaba Cloud Community
January 11, 2021 - # cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 0: 141 0 0 0 IO-APIC-edge timer 1: 10 0 0 0 IO-APIC-edge i8042 4: 807 0 0 0 IO-APIC-edge serial 6: 3 0 0 0 IO-APIC-edge floppy 8: 0 0 0 0 IO-APIC-edge rtc0 9: 0 0 0 0 IO-APIC-fasteoi acpi 10: 0 0 0 0 IO-APIC-fasteoi virtio3 11: 22 0 0 0 IO-APIC-fasteoi uhci_hcd:usb1 12: 15 0 0 0 IO-APIC-edge i8042 14: 0 0 0 0 IO-APIC-edge ata_piix 15: 0 0 0 0 IO-APIC-edge ata_piix 24: 0 0 0 0 PCI-MSI-edge virtio1-config 25: 4522 0 0 4911 PCI-MSI-edge virtio1-req.0 26: 0 0 0 0 PCI-MSI-edge virtio2-config 27: 1913 0 0 0 PCI-MSI-edge virtio2-input.0 28: 3 834 0 0 PCI-MSI
🌐
Umn
stat.umn.edu › macanova › htmlhelp › node164.htm
interrupt
To stop the execution of a command after it has been initiated by Return or Enter, press the interrupt key, defined for specific systems as follows: System Interrupt Key ------ ------------- MacIntosh Command+period or Command+I or Interrupt on the File menu DOS Ctrl+C Unix/Linux Ctrl+C (most common) Windows/Motif Ctrl+I or Interrupt on the File menu.