The kill command is badly named. It does not kill anything. It delivers a signal, a small numbered message from the kernel to a process, and what happens next depends on which signal was sent and how the program was written to react. One of those signals asks politely. One cannot be refused. The difference between them decides whether a database closes its files or leaves them half-written. The commands below were run on a Linux test box with Bash 5.2, and the output is shown as it appeared.
A signal is a message with a default
What the kernel does if the program has no opinion
Every signal has a default action that applies when a program has made no arrangement of its own. The signal(7) manual page defines five:
- Term: terminate the process
- Ign: ignore the signal
- Core: terminate the process and dump core
- Stop: stop the process
- Cont: continue the process if it is currently stopped
A program can replace the default for most signals with a handler, a function of its own that runs when the signal arrives. It can also choose to ignore most signals outright. The exceptions are the heart of this topic.
The ones worth knowing
kill -l prints the full list. The first twenty on the test machine:
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
A handful do nearly all the work in daily administration. Numbers and defaults below are from the manual page, for x86 and ARM:
| Signal | Number | Default | Manual’s description |
|---|---|---|---|
| SIGHUP | 1 | Term | Hangup detected on controlling terminal |
| SIGINT | 2 | Term | Interrupt from keyboard |
| SIGQUIT | 3 | Core | Quit from keyboard |
| SIGKILL | 9 | Term | Kill signal |
| SIGTERM | 15 | Term | Termination signal |
| SIGCONT | 18 | Cont | Continue if stopped |
| SIGSTOP | 19 | Stop | Stop process |
| SIGTSTP | 20 | Stop | Stop typed at terminal |
The numbers are less universal than they look. The manual warns that “many signals have different numeric values on different architectures,” which is the practical argument for writing kill -TERM in scripts and leaving the digits out.

SIGTERM: the request
What plain kill sends
kill 1234 with no option sends SIGTERM, signal 15. A program that has not set up a handler simply dies. The shell records how, in the exit status:
$ sleep 100 &
$ kill $!
$ wait $!; echo "status: $?"
status: 143
The 143 is 128 plus 15. A status above 128 is the shell’s way of reporting death by signal, and subtracting 128 gives the signal number.
What a well-behaved program does with it
SIGTERM can be caught, and that is its entire value. A program that holds open files, network connections or a lock can install a handler that finishes the current piece of work, cleans up and exits on its own terms. A shell script does this with trap:
trap "echo caught TERM, cleaning up; exit 0" TERM
trap "echo caught HUP" HUP
Sending that script a SIGHUP and then a SIGTERM produced:
caught HUP
caught TERM, cleaning up
exit status after TERM handler: 0
The script survived the hangup, ran its cleanup on the termination request and exited with status 0, an ordinary success. From the outside it stopped. From the inside it got to decide how.
SIGKILL: the eviction
No handler, no cleanup, no appeal
The manual page states the rule in one sentence: “The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.”
SIGKILL, signal 9, is never delivered to the program at all. The kernel removes the process. No handler runs, because there is no opportunity for one to run:
$ sleep 100 &
$ kill -9 $!
$ wait $!; echo "status: $?"
status: 137
137 is 128 plus 9.
A test that shows what gets skipped
The following script deliberately ignores SIGTERM and registers a cleanup message to print whenever the shell exits:
trap "echo cleanup ran" EXIT
trap "" TERM
echo "ignoring TERM $$"; sleep 30
A plain kill bounced off it. A kill -9 did not:
ignoring TERM 199
still alive after TERM
status after KILL: 137
The line “cleanup ran” never appeared. The EXIT trap, which Bash runs on any normal termination, was skipped along with everything else. A real service killed this way leaves behind whatever its cleanup code would have removed: temporary files, lock files, a PID file pointing at a process that no longer exists, a write that stopped in the middle.
One curiosity from the same session: trap "echo nope" KILL was accepted by Bash without complaint and returned status 0. The shell lets a script ask. The kernel never delivers the signal, so the handler can never fire.
The right order
The conventional sequence follows directly from all this: send SIGTERM, wait a reasonable time, and resort to SIGKILL only when the process has shown it will not or cannot respond. The timeout command packages the first half of that pattern. It ran a five-second sleep with a one-second limit, sent SIGTERM at the deadline and reported its own special status:
$ timeout 1 sleep 5; echo "rc $?"
rc 124
With -s KILL it reported 137 instead.

SIGHUP: the hangup that became a reload button
From modems to config files
SIGHUP’s description in the manual is a period piece: hangup detected on the controlling terminal, or death of the controlling process. It was the notice a program received when the phone line to a terminal dropped. Its default action is still to terminate, which is why a long job started in an SSH session can die when the connection closes.
Daemons have no terminal to lose, so the signal was free for another job. By long convention, many servers treat SIGHUP as an instruction to re-read their configuration without restarting. The convention is exactly that. It is a choice made by each program’s authors, not a property of the signal, and a program with no handler for it will just exit. The safe habit is to check a service’s own documentation before sending one.
The test script earlier shows the mechanics. Its HUP handler printed a message and carried on, where the default would have ended it.
SIGSTOP and SIGCONT: pause and resume
Freezing a process in place
SIGSTOP is the other signal that cannot be caught, blocked or ignored. It suspends a process without ending it. SIGCONT resumes it. On the test box, ps showed the state change from T, for stopped, back to S, sleeping normally:
$ kill -STOP 203; ps -o stat= -p 203
T
$ kill -CONT 203; ps -o stat= -p 203
S
Pressing Ctrl+Z in a terminal sends the closely related SIGTSTP, which does the same thing by default but can be caught, so an editor gets a chance to restore the screen first.
A stopped process cannot die politely
A second test produced a result that explains a common confusion. A process was stopped and then sent SIGTERM:
$ kill -STOP $p; ps -o stat= -p $p
T
$ kill -TERM $p; ps -o stat= -p $p
T
$ kill -CONT $p
gone after CONT
The termination request did nothing visible while the process was frozen. It sat pending. The instant SIGCONT arrived, the process woke, received the queued SIGTERM and exited. A stopped process that “won’t die” from an ordinary kill is usually just waiting to be continued.

Checking and targeting
Signal zero
kill -0 sends nothing at all. It only reports whether a signal could be delivered, which makes it a quick existence test in scripts:
$ kill -0 $$ && echo "pid $$ exists"
pid 181 exists
$ kill -0 999999
bash: kill: (999999) - No such process
By name, not by number
pgrep and pkill match processes by name or command line, sparing the two-step of looking up a PID. With two sleep 222 jobs running, pgrep -a sleep listed both, and pkill -f "sleep 222" ended both. pkill sends SIGTERM unless told otherwise and accepts the same signal options as kill. The -f flag matches against the full command line, which is powerful and deserves a pgrep -af dry run first to see what a pattern will hit.
Ctrl+C, Ctrl+ and Ctrl+Z
The keyboard sends signals too
Three key combinations in a terminal map to three signals from the table. Ctrl+C sends SIGINT, the interrupt from keyboard. Ctrl+ sends SIGQUIT, whose default action is to terminate and dump core, which is useful for capturing the state of a hung program for debugging. Ctrl+Z sends SIGTSTP.
All three can be caught. That is why Ctrl+C in an interactive program often cancels the current operation instead of ending the session: the program chose a gentler meaning for the interrupt.
A short reference
kill PID: ask (SIGTERM, catchable, cleanup runs)kill -HUP PID: reload on many daemons, terminate on programs without a handlerkill -STOP PIDandkill -CONT PID: pause and resumekill -0 PID: check existence onlykill -9 PID: last resort, nothing in the program runs again
Sources
- Linux manual pages, signal(7): https://man7.org/linux/man-pages/man7/signal.7.html
- Test commands and output: Bash 5.2.21 on Linux, run for this post
