How to Kill a Process in Linux?

To kill or terminate a Linux process, we can use the kill command. We need to kill the Linux process if it becomes unresponsive.

Below is the syntax of this command.

## Kill by using PID
kill <PID>

## Kill the process by using Name
kill <process_name>

Here, PID is the process Identification of the process that is being executed. We can kill a Linux process using two ways.

  • kill <pid>: This generates a signal SIGTERM allows the Linux process to be terminated gracefully by using the PID..
  • kill -9 <pid>: This generates a signallSIGKILL which will forcefully terminate the Linux process by using PID.
SignalNumberDescription
SIGKILL9It makes the process to exit without carrying out any routine tasks
SIGTERM15It causes the process to exit. But it allows us to close any files that are open
SIGHUP1It terminates the interactive process and programs in Linux
SIGCONT18,19,25It continues the process if stopped in between
SIGSTOP17,19,23It stops the process