kill
Commandkill
The kill
command is used to send signals to processes, typically to terminate them. While the most common signal is SIGTERM
(signal number 15), which requests a graceful shutdown, kill
can send various signals to control process behavior.
kill [OPTIONS]
kill
-l
(List Signals)List all available signal names:
kill -l
-s
(Specify Signal)Specify the signal to send by name or number:
kill -s SIGKILL
-n
(Numeric Signal)Send a signal using its number:
kill -n 9
This sends the SIGKILL
signal (9) to the specified process.
-p
(Process ID)Only print the process ID without sending a signal:
kill -p
Signal | Description |
---|---|
SIGTERM (15) |
Request termination of a process (default signal). |
SIGKILL (9) |
Force termination of a process (cannot be caught or ignored). |
SIGHUP (1) |
Hang up signal, often used to reload configurations. |
SIGINT (2) |
Interrupt signal, usually sent by pressing Ctrl + C . |
SIGQUIT (3) |
Quit signal, often produces a core dump. |
kill
Commandkill 1234
This sends the SIGTERM
signal to process ID 1234.
kill -9 1234
This sends the SIGKILL
signal to process ID 1234.
kill -l
This displays a list of all available signals.
Option | Description |
---|---|
-l |
List all available signal names. |
-s |
Specify the signal to send by name or number. |
-n |
Send a signal using its number. |
-p |
Only print the process ID without sending a signal. |