6 Different Ways To Kill Unresponsive Programs in Linux

Most Windows users know about the utility of the Ctrl + Alt + Del keys when dealing with an unresponsive application. A program is said to be unresponsive when it doesn’t respond to any user interaction and neither does it perform its intended actions. There are plenty of jokes surrounding the whole Ctrl + Alt + Del combination that brings up the task manager in Windows and allows you to end unresponsive applications. Things seldom go this far in the Linux world, however claiming that such Linux unresponsiveness doesn’t occur would be a plain lie.

The good thing about Linux is that you almost never have to hit the reset button due to unresponsive or hung applications. There are so many ways you can gain back control that you never have to resort to such extreme measures. In this article, we take a look at some of the ways you can deal with unresponsive applications on your Linux box.

Dealing with Linux Unresponsiveness – Using System Monitor

First and foremost you can use the familiar System Monitor tool. It looks a lot like the Windows Task manager, only it is better. Not only does it provide you with lots of information about the current state of the computer system, you can use the Processes tab to look for any misbehaving applications and choose to Kill or Stop the process. Both of these operations are very different in the Linux world: stop suspends the execution of the process and kill would close it completely.

Using the ‘kill’ command

So far so good, however there are times when you cannot use the GUI altogether. Starting the System Monitor is out of question in such situations. In these situations, you can leverage the power of Linux command line to your advantage. You can enter these commands in a terminal if it is available or you can switch to a virtual terminal using Ctrl + Alt + F1 and logging in using the text mode.

Each running process has a unique process ID under Linux. If you know the process ID of the miscreant you can straightaway issue:

kill <processID>

to kill the misbehaving process. This should hopefully restore some sanity to your computer and you can switch back to the GUI using Ctrl + Alt + F7.

Using the ‘pkill’ and ‘pgrep’ commands

If on the other hand you don’t know the process ID then you can either kill the process by its name or you can analyze all the running processes to diagnose the problem (using something like the top command).

You can use the pkill command to kill using process name. As an example the following command would kill Firefox:

pkill firefox

Notice how you didn’t have to know or specify the process ID. Alternatively, you can use the pgrep command to get the process ID of any running process on the system. The process ID can then be used to kill or send other signals to the process.

Using the ‘xkill’ command

When using the GUI you can also use the xkill command which makes your mouse pointer all mighty and powerful After issuing the xkill command you can click on the application you want to kill and it will be gone and killed for you in a click!

Using the ‘killall’ command

Last but not the least, there is the killall command. Terrifying as it may seem, it doesn’t kill all the processes running on the computer. Instead it is used to kill multiple instances of the same program. eg killall firefox will kill all windows and Firefox profiles that might be currently executing.

There are a lot more to these commands than what can be covered in a short write-up. ‘pkill’ for instance, lets you search for a process not only by its name but by the user who owns the process, the time it was started or lists all the processes that do not match a certain criteria. In addition, these commands can be used to send other signals to the processes as well. By default, SIGTERM is sent which may be ignored by some processes in which case you can use the kill -9 <processID> to send a KILL signal. You can learn about all the options by reading the manuals for the respective commands.

Have you ever faced similar situations with Linux unresponsiveness? What did you do to resolve them?

Get the best tips from MakeUseOf in your inbox, free!

Benny the Irish polyglot

December 14, 2009

Surprised to not see the absolute easiest option of all for those of us who prefer the GUI. Right click the panel click “add to panel” then “Force Quit”. From now on, you are just just two clicks to killing any unresponsive app (presuming it occupies a clickable window). I imagine this uses the xkill command you mentioned, but two clicks is quicker :)

Even Easier

December 16, 2009

In most Linux GUIs, just press toghether Ctrl-Alt-Esc to get a killing mouse pointer (just like xkill, but easier).

If you change your mind, just press Esc to abort killing and revert to a normal pointer.

neil

December 16, 2009

Often it is full screen games that go bad and lock out the keyboard. For that I ssh in and just do kill the offending app via the shell. Of course, this way is no use if you are not running ssh and do not have a second computer handy.

Bodo

December 17, 2009

If you don’t have a computer handy (presuming you do have ssh installed on your pc) you can also use a Nokia or other S60 device with PuTTY installed to ssh in ;-)

Unixpert

December 16, 2009

I’ve never had a system lock up to the point where I’ve lost the GUI, but I’ve had several applications lock. Mostly Firefox alphas and ALWAYS K3B & Devede during the Ubuntu alpha phase. My favorite way of dealing with them is simply gnome-do +xkill. alt-F2/Krunner works too, but I find the whole “alt-F2″ key command difficult to hit. Superkey+space is so much easier.

James D

willmake

December 16, 2009

The worst trouble about unresponsive programs happen when they also block the keyboard and mouse, making it impossible to enter commands. Then the only solution is an hardware reset witch may cause data loss and/or file corruption.

banjo

December 17, 2009

I run Mint Gloria version. Very often when i try to type in a URL firfox freezes to the point where the GUI , mouse , key board becomes unresponsive. I have tried Ctrl Alt Backspace, Ctrl Alt B, etc to no effect . Usually I have to power down and restart. Any suggestions???????

rems

PBhat

December 17, 2009

While Windows ‘blue screen of death’ is much maligned in the Linux world,the linux ‘busy screen of death’ is no less malignant.While unresponsive programs in Windows do not seem to touch keyboard and/or mouse,the first thing that happens in linux in a race or lock conditions is the death of keyboard/mouse.
The core OS and Shell may all be in good shape,but when keyboard/mouse are dead,all that you have described is no use.I have many times experienced that.The remote options are not available to ordinary user.
The linux kernel is happy about letting an application take over entire system,it seems.Throw a tiff file with multiple pages and try to open it,the system goes into a spin of no return.None of these options are open then.

Jahm Mitt

December 17, 2009

Ohhhh Ha Ha Ha

“While Windows â€˜blue screen of deathâ€™ is much maligned in the Linux world,the linux â€˜busy screen of deathâ€™ is no less malignant”……

Yeah FIREFOX gets into MEMORY LEAKS and SYSTEM HOGGING like a battleship in a bathtub….

Ctrl + Alt + Esc = KILLL ITTTTTT OFFFFFFFFFFFFFFFFFFFFFFFF

PBhat

December 19, 2009

To read care-FULLY and understand is the biggest service you can do to Linux or whatever else.Thank you.

GB

December 17, 2009

Since I started to play with Google Chrome on Linux, I regularly see Chrome starting to do ridiculous amounts of I/O for no good reason that I can fathom. The keyboard and mouse become unresponsive as the kernel struggles to handle the load. The only reliable way I have found to kill it is to ssh in from another computer and issue “pkill chrome”.

I wonder would I would do (other than a hard restart of the whole computer) to restore normality without a second computer to use.

Dennis Murczak

December 17, 2009

In KDE, you can bring up a process list using CTRL-ESC and kill (or renice) the process from there. xkill is bound to CTRL-ALT-ESC. Or just click on the close button of the unresponsive window and wait a few seconds.

If Plasma crashes and isn’t restarted automatically, you can usually still bring up krunner via ALT-F2. Else, go to a fullscreen VT and run killall X to re-login.

reup

December 17, 2009

for users with compiz(-fusion) the esc key cannot be used as shortkey, you need to change the xkill shortcut from CTRL-ALT-ESC to something like CTRL-ALT-end (that what I choose) in the ccsm (compiz control system manager ?)

I would like to redirect some of you to this great article that explain how to save yourselves from a kernel lock using the otherwise useless key sys-rqhttp://www.linuxhowtos.org/Tips and Tricks/sysrq.htm

kevin

December 17, 2009

This is a good article. I do not use very powerful computers and they seem to lock up sometimes. It seems to happen more often lately. I use Ubuntu with firefox. When i have more than a couple applications running with firefox,things slow down and, I get frozen mouse and screen. I usually shut down the system and then reboot. It doesn’t seem to affect anything but my time and patience. I recently loaded the latest ubuntu 9.something and I’ve already gotten a couple of freezeups. I will save this article and try some of the suggestions.

bhagya

December 17, 2009

I was using ‘wammu’ lately, when suddenly my comp froze.. The mouse pointer froze.. and the ‘caps-lock’ light started turning on and off… I couldn’t even switch to the command line mode then… Nor could do anything with the frozen GUI…

Any suggestions, how to handle such situations except rebooting…?

Felix

December 21, 2009

Blinking keyboard LEDs are an indication for Kernel panic. You’re out of luck in this situation. After reboot, you might want to check the system logs for possible causes.

Einheit

khinch

December 20, 2009

I haven’t seen any mention of the “ALT+SYSRQ” combinations so far.

Even when a misbehaving app locks out your keyboard, the kernel will still respond when “ALT+SYSRQ” are pressed together. (On some keyboards SysRq is labelled as “Print screen”, on others it’s labelled on its own).

99% of the time when a Linux system won’t respond to any of the above, you can safely reboot by holding down ALT + SysRq and then R,E,I,S,U,B, leaving a quick pause between each key for the system to respond. You can easily remember that combo because it is BUSIER backwards.

This has saved me a few times when I have been mincing around with some settings I probably shouldn’t have!