UNIX Signals
SIGINT, SIGTERM, SIGKILL, SIGQUIT, SIGABRT... it seems like UNIX has a confusing number of signals that terminate a process. Here’s a list to help sort them out.
| Name | Number | Meaning | Default action | Key |
|---|---|---|---|---|
HUP |
1 |
Terminal line hang up (or process group orphaned or controlling process exited) |
Terminate process | |
INT |
2 |
Terminal interrupt — this is specifically the user asking for the program’s attention |
Terminate process | ^C |
TERM |
15 |
Terminate — this is the "normal" termination signal sent by |
Terminate process | |
KILL |
9 |
Kill program (cannot be caught or ignored) — used by system to kill processes: Note: |
Terminate process | |
QUIT |
3 |
Abnormal program termination from terminal |
Dump core | ^\ |
ABRT |
6 |
Abnormal program termination — used by |
Dump core | |
STOP |
17 |
Stop (cannot be caught or ignored) |
Stop (suspend) process | |
TSTP |
18 |
Stop signal generated from terminal |
Stop (suspend) process | ^Z |
INFO |
19 |
Status request from terminal |
Discard signal | ^T |
NOTE: Signal numbers 17, 18, and 19 are not standardized by POSIX. The SIGINFO signal is not standardized by POSIX.
To recap, there are basically three types of program terminate signals:
TERM— the "please exit" signalKILL— the "you must die" uncatchable signalABRT— the "abnormal termination" signal
QUIT is the terminal generated ABRT equivalent.
INT is not a termination signal necessarily, but if the program doesn’t have any better action to take, the default is termination.
HUP is also not a termination signal necessarily, but if the program doesn’t have any better action to take, the default is termination.
STOP and TSTP, though their name may sound like termination, are really job control signals used to suspend a process for later resumption (in the foreground or background).
INFO is a non-standard, but common, signal that by default prints a one-line status of the current command and processor usage.