Frequently Asked Question

What is a Unix signal and how do I send one?

A signal is a small asynchronous notification the kernel delivers to a process, interrupting whatever it is doing. Each signal has a number, a symbolic name, and a default action: terminate, terminate with core dump, stop, continue, or ignore. The common ones are SIGINT (2, Ctrl-C, "please interrupt"), SIGTERM (15, "please exit gracefully"), SIGKILL (9, "die immediately, no questions"), SIGHUP (1, "your terminal hung up"), SIGSTOP (19, "pause") and SIGCONT (18, "resume").

The kill command is misnamed, it sends any signal you choose, not just lethal ones. kill 12345 sends SIGTERM; kill -9 12345 sends SIGKILL; kill -HUP 12345 sends SIGHUP, which many daemons interpret as "re-read your config file". The idiomatic shutdown order is SIGTERM first, wait a few seconds for the process to clean up, then SIGKILL if it refuses to die. kill -l lists every signal name your system knows.

Video

Further reading and video