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, supposing that Mozilla is the misbehaving program. You will get something like the following:

peter      3505  7.7 23.1 24816 15076 pts/2   Z    21:29   0:02 /usr/lib/mozilla

This tells us, amongst other things, that Mozilla was started by user peter and that its PID is 3505.

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! Mozilla will be 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, what we have done was send 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.

[Tip]Tip

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