How to kill a not responding application on Linux

Written by
Date: 2011-01-07 10:36:30 00:00


Introduction

I’ve seen this very few times in Linux, but yes sometimes it happens, an application or process stop responding and gives you no other option than to terminate it.

In Windows, you press ALT-CTRL-DEL then look for the not responding application and close it, if you are lucky enough and Windows is still responding.

To do something like that in Linux, we will use the console, it is the best way, because if you are on your really bad day, you may have even X not responding, so you will have to another terminal. Pressing ALT-CTRL-F2 will do the trick, if even that is not working you can also go to another computer and ssh to the PC with problems, this final option never failed to me.

Killing a not responding application in Linux

Let’s imagine the not responding application is OpenOffice, the process in Arch Linux is called soffice, in your distribution may vary.

So, the first thing you need to do is to identify the ID of the application, I normally use this command for that task:

pstree -p

That way I identify the parent process, and I’m able to kill it with all their children. Once you have your process ID identified, you can kill it:

kill 1234

Where 1234 is the process ID you have found using pstree.

This should work, but if the application is really really not responding this isn’t going to work, as this command is not actually killing the process, it is asking it to please close.

We now have other option, will be rude.

kill -9 1234

This will really kill the application, now you can go back to your job, as you once again have the control of your PC.

I’m using pstree to identify the parent process, you can just run ps aux and then when you find the name of the process or application you want to kill, use its name and use killall

So, in the case of my example that would be:

killall soffice

That will kill all processes named soffice