In kill -9
, what does the parameter -9
do? Sometimes I see this as a suggestion when you need to kill a process using the command line.

- 133
- 12
-
1Hope this link will help you, 9 Represents SIGKILL signal https://stackoverflow.com/questions/9951556/why-number-9-in-kill-9-command-in-unix – Kavin Kumar May 24 '17 at 11:27
1 Answers
kill
is a terrible name for the utility because it doesn't necessarily kill anything. kill
sends a signal to a process. A signal is an integer that causes the process to do something out of sequence with its normal execution.
The default signal is 15 so kill 1234
is the same as kill -15 1234
which sends signal 15 to process number 1234. Signal 15 is the TERM signal which normally terminates the process.
Processes can install signal handlers that change the way the process responds to signals (which would normally otherwise terminate the process). For example, you can have a handler for the TERM signal which tidies up the process allowing it to stop in a safe way. You can also have the process ignore the signal.
kill -9
sends the KILL signal to a process. This is one signal for which you ccannot have a signal handler and cannot be ignored. It's the only sure fire way to stop a process although it may leave your process's persistent state (e.g. files) in an inconsistent state.

- 84,577
- 15
- 123
- 161