Hitman: How to Kill a Computer Process

I’ve ran into this issue, from time to time, where I can’t access my graphical system monitoring tool (System Monitor) to kill processes. Luckily at that time I do have access to Terminal. The next question is, “Well; how do I view the processes running and how do I kill them?” Good question (I sound like a schizophrenic), let me tell you how to view your active processes, all processes, and how to MDK (murder death kill; Demolition Man reference) them.

Bash Command, “PS”

Open your terminal of choice and you will have the bash command “ps” available to you. “PS” stands for “process”; simple enough. You can find more about the bash command by typing in “man ps”. It will bring up the “man page” (Linux User’s Manual).

  1. Type “ps -e” or “ps -A”, to list all processes running, and press <ENTER>.
  2. Scroll down to find the program you want to kill and remember the process id number (pid).
  3. Then type “kill {pid}” and press <ENTER>. Replace {pid} with the actual process id number.

Example:

In this example, we’ll say that tomboy was causing your system to freeze up and you needed to get rid of that process. After you execute the command “ps -e” to see all processes, find “tomboy” and remember the pid in the first column. Then run the kill command.

ps -e
kill 3009

Understanding the “Process”

According to the Linux User Manual, “ps” reports a snapshot of the current processes. What are processes, yeah this might be a good time to explain that. Check out Wikipedia… isn’t that where everyone gets their solid facts from!? Well anyway, a process is a running program; a task to be executed, especially one which is largely self-contained. Seriously; I’m not going to write a lot about it. Wikipedia has a lot more information.

“X” Marks the Spot

This command is very convenient and may be quicker than finding the process then killing it.  If the program that’s causing errors is right there in the open… then open your Terminal and type in “xkill”.  This will change your mouse pointer to a skull and crossbones.  Make sure you can easily see the program.  Once you click on it, Linux will kill the program clicked.  Pretty neat, eh!?