kill
command
https://linuxize.com/post/kill-command-in-linux/
The syntax of the kill
command takes the following form:
kill [OPTIONS] [PID]...
The kill
command sends a signal to specified processes or process groups, causing them to act according to the signal. When the signal is not specified, it defaults to -15
(-TERM).
The most commonly used signals are:
1
(HUP
) - Reload a process.9
(KILL
) - Kill a process.15
(TERM
) - Gracefully stop a process.
Use -9
flag to kill process.
kill -9 <process-id>
or
kill -KILL <process-id>
If you use the flag 15 (TERM)
it only stops a process.
To get a list of all available signals:
kill -l
Signals can be specified in three different ways:
- Using number (e.g.,
-1
or-s 1
). - Using the “SIG” prefix (e.g.,
-SIGHUP
or-s SIGHUP
). - Without the “SIG” prefix (e.g.,
-HUP
or-s HUP
).
The following commands are equivalent to one another:
kill -1 PID_NUMBER
kill -SIGHUP PID_NUMBER
kill -HUP PID_NUMBER