9. Killing Misbehaving Apps

Well, this one is not so hard after all. You have many ways to do it. You can do it by finding the PID of the program which stopped responding, and then using the kill command to terminate it, or you can use the xkill tool or other graphical tools such as the ones that show the process tree.

9.1. From the Console

The first thing to do to terminate a misbehaving program is to find its PID, or process ID. To do so, execute the following from a console: ps aux | grep mozilla-firefox-bin, supposing that Firefox is the misbehaving program. You will get something like the following, which tells you among other things that Firefox was started by user peter and that its PID is 3505:

peter   3505  1.7  5.0  82208 25804 ?        Sl   09:30   0:01 /usr/lib/mozilla-firefox-1.0.6/mozilla-firefox-bin

Now that we have the PID of the misbehaving program, we can execute the kill command to terminate it. So we execute the following: kill -9 3505, and that's it! Firefox is killed. Note that this is only to be used when the program doesn't respond to your input anymore. Do not use it as a standard means of exiting from applications.

Actually, we sent the KILL signal to the process number 3505. The kill command accepts other signals besides KILL, so you can have greater control over your processes. For more info, see kill(1).

9.2. Using Graphical Monitoring Tools

You can also use the graphical process' status tools (like KPM, KSySGuard, and GTOP to name a few) which allow you to point to the process name and with one click send that process a signal or just kill that process.

[Dica]Dica

If you are using KDE, you can press the Ctrl-Alt-Esc keys: the pointer changes to a skull with crossed bones and you can simply click on the window of the misbehaving application to kill it.