When a CTRL-... key sequence is pressed in a terminal, the terminal sends a corresponding signal to the shell, which forwards it to the stdin of the currently running program.
Mapping of key sequences / signals : stty -a
Bash shortcut keys
Flag | Usage |
---|---|
-l | list available signals |
-signalName -s signalName |
send the signal signalName :
kill -s stop 12345 kill -s STOP 12345 kill -s sigstop 12345 kill -s SIGSTOP 12345 sleep 10 & kill -1 $! sleep 10 & kill -hup $! sleep 10 & kill -sighup $! sleep 10 & kill -s hup $! sleep 10 & kill -s sighup $! |
Signal | Description | # | Usage |
---|---|---|---|
SIGHUP | Hangup | 1 | This argument makes kill send the Hang Up signal to processes. This probably originates from the modem/dial-in era. Processes have to be programmed to actually listen to this signal and do something with it. Most daemons are programmed to re-read their configuration when they receive such a signal. Anyway, this is very likely the safest kill signal there is, it should not obstruct anything. |
SIGINT | Interrupt | 2 | This signal is sent to the program being executed when CTRL-c is pressed in a terminal. Most programs will stop, you may lose data. |
SIGQUIT | Quit and dump core | 3 | |
SIGILL | Illegal instruction | 4 | |
SIGTRAP | Trace/breakpoint trap | 5 | |
SIGABRT | Process aborted | 6 | |
SIGBUS | Bus error: "access to undefined portion of memory object" | 7 | |
SIGFPE | Floating point exception: "erroneous arithmetic operation" | 8 | |
SIGKILL | Kill (terminate immediately) | 9 | The kernel will let go of the process without informing the process of it :
kill -9 could result in data loss. This is the "hardest", "roughest" and most unsafe kill signal available, and should only be used to stop something that seems unstoppable. This signal is NOT catchable. |
SIGUSR1 | User-defined 1 | 10 | |
SIGSEGV | Segmentation violation | 11 | |
SIGUSR2 | User-defined 2 | 12 | |
SIGPIPE | Write to pipe with no one reading | 13 | |
SIGALRM | Signal raised by alarm | 14 | |
SIGTERM | Termination (request to terminate) This is the default signal. |
15 | Tell the process to :
There _may_ be situations where the process is on an uninterruptible task and ignores this signal. |
SIGCHLD | Child process terminated, stopped (or continued*) | 17 | |
SIGCONT | Continue if stopped | 18 | |
SIGSTOP | Stop executing temporarily | 19 | This signal is NOT catchable. |
SIGTSTP | Terminal stop signal | 20 | This signal is sent after a CTRL-z in a terminal. |
SIGTTIN | Background process attempting to read from tty ("in") | 21 | |
SIGTTOU | Background process attempting to write to tty ("out") | 22 | |
SIGURG | Urgent data available on socket | 23 | |
SIGXCPU | CPU time limit exceeded | 24 | |
SIGXFSZ | File size limit exceeded | 25 | |
SIGVTALRM | Signal raised by timer counting virtual time: "virtual timer expired" | 26 | |
SIGPROF | Profiling timer expired | 27 | |
SIGPOLL | Pollable event | 29 | |
SIGSYS | Bad syscall | 31 |