Kill command is used to terminate a process in Linux. The kill command sends the specified signal such as kill process to the specified process. If no signal is specified, the SIGTERM signal is sent.
kill [signal] PID
A list of common signals:
|SIGHUP-(1)||Hangup detected on controlling terminal or death of controlling process. Use SIGHUP to reload configuration files and open/close log files|
|SIGKILL-(9)||Kill signal. Use SIGKILL as a last resort to kill process. This will not save data or cleaning kill the process|
|SIGTERM-(15)||Termination signal. This is the default and safest way to kill process|
For example, we are terminating process java with a -15 signal, which will terminate the process safely.
Points to remember:
- You can kill all your own processes.
- The only root user can kill system-level processes.
- The only root user can kill process started by other users.