How do I kill a process?
Author: Deron Eriksson
Description: This Linux tutorial demonstrates how to kill a process.
Tutorial created using: CentOS release 4.6
The "kill" command can be used to kill a process. To kill a process, you pass the kill command the process ID of the process that you'd like to kill. You can obtain this PID number via the "ps" command, as shown below.
I have a grep command running that I'd like to kill. The ps command reveals that the PID number of the grep command is 15799, so I issue:
Sometimes, you might run into a situation where you can't kill the process with a regular kill command. In that case, you might want to issue a "kill -9" command. This is an uberkill command, or as Paul Reubens would say, "Kill him a lot!"
Below, I start another grep command in the background. I get the process ID via "ps -u", which reveals the PID of 26506. After that, I issue a "kill -9 26506" command, which kills the process. We can see the process has been killed by issuing another "ps -u" command.