J^T: John Thywissen's personal pages

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
SIGHUP
1

Terminal line hang up (or process group orphaned or controlling process exited)

Terminate process
INT
SIGINT
2

Terminal interrupt — this is specifically the user asking for the program’s attention

Terminate process ^C
TERM
SIGTERM
15

Terminate — this is the "normal" termination signal sent by kill and shutdown

Terminate process
KILL
SIGKILL
9

Kill program (cannot be caught or ignored) — used by system to kill processes: shutdown timeout after SIGTERM or traced process's parent exit or ptrace kill action or code signing failure

Note: SIGKILL bypasses all cleanup / atexit actions. Using it may result in a damaged state.

Terminate process
QUIT
SIGQUIT
3

Abnormal program termination from terminal

Dump core ^\
ABRT
SIGABRT
6

Abnormal program termination — used by abort and assert functions

Dump core
STOP
SIGSTOP
17

Stop (cannot be caught or ignored)

Stop (suspend) process
TSTP
SIGTSTP
18

Stop signal generated from terminal

Stop (suspend) process ^Z
INFO
SIGINFO
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:

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.