Sometimes processes stop performing or unexpectedly die and when you try to re-run the process again, you may get an error as the original never truly shut down completely. In such a case, you need to kill the process using the command line. You can kill the process in multiple ways. We have covered some of it in this article.
There are different signals that can be sent to both kill commands. We can use a signal to kill a process with names and numbers. To find out the signal’s name and number, run the following command:
Here you can find a list of signals. There are 3 signals, we’ve covered.
SIGKILL – 9 – Forcefully close
SIGTERM – 15 – Termination signal
SIGSTOP – 19 – Stop the process
Find the process ID using the PS command
ps aux | grep [process name]
Find the process ID using the pgrep command.
(Here you need to know the process name to find the process ID. If you don’t know the process name, you need to use a different way to find the process ID.)
pgrep [process name]
Find the process ID using the top command:
To kill the process: kill -9 (–SIGKILL) [PID] type k enter type PID enter
(Now type signal. By default, the signal set to 15/sigterm. You can change it or use it by entering)
kill -9 [PID]