Pinterest Stumbleupon Whatsapp
Ads by Google

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.

kill unresponsive program

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.

Ads by Google

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?

  1. fbfhn
    April 29, 2016 at 10:42 am

    i still don't understand how can we use the top command with ps and kill to see if a computer is misbheaving

  2. matin
    December 5, 2015 at 4:18 pm

    wow niceeeeeeeeeeeeeeeeeeee

  3. rain
    January 8, 2010 at 6:53 pm

    wow it's so nice to know those i know how powerful Linux is

  4. ewqtrwerw
    December 21, 2009 at 11:27 am

    Another amazing utility is top and its variants. Simply run top, look for your process and finaly hit kyy k (K) (and specify a number of the process).

  5. khinch
    December 20, 2009 at 2:36 pm

    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!

  6. Einheit
    December 20, 2009 at 1:08 pm

    Might be good to try kill -2 (SIGINT), before kill -9, since that has the possibility of causing problems.

  7. bhagya
    December 17, 2009 at 10:54 pm

    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 at 1:52 am

      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.

  8. kevin
    December 17, 2009 at 8:31 pm

    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.

  9. reup
    December 17, 2009 at 5:31 pm

    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-rq and Tricks/sysrq.htm

  10. Dennis Murczak
    December 17, 2009 at 8:26 am

    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.

  11. GB
    December 17, 2009 at 6:47 am

    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.

  12. PBhat
    December 17, 2009 at 3:14 am

    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 at 10:01 pm

      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....


      • PBhat
        December 19, 2009 at 8:52 pm

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

  13. banjo
    December 17, 2009 at 2:58 am

    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???????

  14. willmake
    December 16, 2009 at 2:29 pm

    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.

  15. James D
    December 16, 2009 at 2:27 pm

    And there's the intermediate stage between the GUI and pkill: htop, everyone's favorite curses application.

  16. Unixpert
    December 16, 2009 at 10:27 am

    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.

  17. neil
    December 16, 2009 at 3:52 am

    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 at 2:17 am

      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 ;-)

  18. Rioting_pacifist
    December 15, 2009 at 9:48 am

    I find htop to be a good tool to use from the command line

    Also note that killall does kill everything on other operating systems so it's better to get used to using pkill to avoid using killall on solaris by mistake.

  19. Jude
    December 14, 2009 at 10:30 pm

    If it's something that's eating up all my memory or CPU cycles, I always use top, and then k (kill inside top) and then enter the pid of the errant application.

  20. Ikai Lan
    December 14, 2009 at 4:56 pm

    Don't leave out switching your TTY if a single app blocks your entire GUI and you can't pull upa terminal window or the process monitor:

    Control-Alt-F1/2/3/4/5/6, killall -9 java, Control-Alt-F7 to go back to your Window manager.

    • Ikai Lan
      December 14, 2009 at 4:57 pm

      D'oh, it is in there. Never mind.

  21. Benny the Irish polyglot
    December 14, 2009 at 3:39 pm

    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 at 2:21 pm

      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.

Leave a Reply

Your email address will not be published. Required fields are marked *