7 Different Ways To Kill Unresponsive Programs in Linux
Pinterest Stumbleupon Whatsapp
Advertisement

Linux software is typically robust enough to work without causing any problems, but from time to time, even the best apps The Best Linux Software The Best Linux Software Linux is full of awesome apps, both open source and proprietary. People new to Linux and even seasoned Linux users tend to find new and useful software quite often. Here's what we love. Read More might hang. Rather than wait for them to crash, you can kill these unresponsive programs. In fact, there are so many ways to kill them that you might find you’re spoiled for choice!

If you’re experiencing problems with an application in Linux, here are seven ways to kill unresponsive software.

1. Click the X in the Corner

You’ve probably already tried walking away and making a hot drink. If you returned to your PC to find that the app is still hanging, it’s probably had enough time to start working again. An unresponsive app typically has grayed-out buttons, or options that don’t appear to work. You may also be unable to move the app window around the screen.

7 Different Ways To Kill Unresponsive Programs in Linux muo linux unresponsive close

So, what is the solution? Well, at this stage, you can try clicking the X button in the top corner (left or right, depending on your Linux operating system The Best Linux Operating Systems The Best Linux Operating Systems There are many Linux distributions available for a number of different purposes, which makes it difficult to choose at times. Here's a list of the very best to help you decide. Read More ). This should stop the program dead in its tracks. You might also see a dialog box, asking you to either Wait for the program to respond or Force Quit to end it now.

If all goes to plan, some distros will prompt you to send an error report.

Either way, the application should have stopped running. But what if it hasn’t…?

2. System Monitor

The next option is to open your Linux operating system’s System Monitor utility, much like the Windows Task Manager How To Handle Suspicious Windows Task Manager Processes How To Handle Suspicious Windows Task Manager Processes CTRL + ALT + DEL aka three-finger salute is the quickest way to add to your confusion. Sorting through Task Manager Processes, you may notice something like svchost.exe using 99% of your CPU. So now... Read More . This is typically found in the System Tools menu, and once launched will display a list of running processes under the Processes tab.

7 Different Ways To Kill Unresponsive Programs in Linux muo linux unresponsive kill process

To close an unresponsive application here, simply select it and right-click. You then have three options:

  • Stop Process — this pauses the process, letting you continue it later. It won’t work in most cases.
  • End Process — the correct way to close a process, this will safely terminate the application, cleaning temporary files on the way.
  • Kill Process — this is the extreme option, and should only be used if End Process fails.

It’s best to use these in order. However, if the application is one that hangs regularly, you might prefer to jump to the command that you know works.

3. Close Linux Apps with “xkill”

Another option you can employ is xkill. This is preinstalled in Ubuntu, but you can install it via the Terminal (which you can open with CTRL + ALT + T) if necessary. When called, xkill will enable you to close any desktop app. Install it with the following command:

sudo apt-get install xorg-xkill

Once this is done, run xkill by simply typing

xkill

Your mouse pointer will then display a cross (or a skull), and all you need to do is left-click on the offending application.

If it’s not possible to close your unresponsive app with any of these desktop-focused methods, the solution might be the command line…

4. Use the “kill” Command

If your app is unresponsive and the above suggestions don’t work (the GUI might be unresponsive), hit CTRL + ALT+ T to open the Terminal. (With some distros, CTRL + ALT + F1 will open a virtual terminal — you can switch back to the desktop with CTRL + ALT + F7.)

Several command line options are available to help you to close your app. Better still, these can be used either on your computer or by connecting over SSH Beginner's Guide To Setting Up SSH On Linux And Testing Your Setup Beginner's Guide To Setting Up SSH On Linux And Testing Your Setup Arguably one of the most important Linux utilities to learn is SSH as you can control a different machine as if you were sitting directly at it. We'll take you through a basic installation. Read More from another device.

7 Different Ways To Kill Unresponsive Programs in Linux muo linux unresponsive kill

The kill command can be used here, but first requires a process ID. You can find this by running a command interrogating the application for its process ID:

ps aux | grep [process name]

The result will display the process ID. This can then be used as follows:

kill [process ID]

Note that you may need to append the command with sudo.

5. Use “pkill” and “pgrep” to Kill Unresponsive Software

What if you don’t know, or cannot find, the process ID? This is where the pkill command comes in. Rather than a process ID, simply use pkill along with the process name:

pkill [process name]

Alternatively, you can use the pgrep command to find the process ID:

pgrep [process name]

…and following this, use pkill with the process ID.

7 Different Ways To Kill Unresponsive Programs in Linux muo linux unresponsive pkill

pkill [process ID]

As with the kill command, this should close the process within around 5 seconds.

6. Kill All Instances with “killall”

No luck with kill or pkill? It’s time to use the nuclear option: killall.

Fortunately, it isn’t as devastating as it might be. The killall command will end all instances of a particular program. So, rather than killing one Firefox window, the following command will end them all:

killall firefox

All you need is the process name and the killall command (possibly with sudo if demanded by your setup).

killall [process name]

Naturally, you should only use this command when needed. It’s unsuitable for most unresponsive program situations.

7. Create a Keyboard Shortcut

If you want to save time closing unresponsive software — perhaps you have some regular offenders — then the best option is to create a keyboard shortcut. This will give you the immediate option to close an app, but you’ll need to have xkill installed for this to work.

7 Different Ways To Kill Unresponsive Programs in Linux muo linux unresponsive xkill

In Ubuntu, for example, you can open Settings > Keyboard and click on Shortcuts. Select Custom Shortcuts, then + to create a new shortcut. Input “xkill” for both Name and Command, then click Apply. This will return you to the shortcuts list — select the shortcut, then press the required keyboard combination that you will use to call it.

Next time you need to close an app, just use the keyboard shortcut. The mouse pointer will become an X, and you can click anywhere on the app you want to close.

Avoid Unresponsive Software: Upgrade Your Hardware

Are unresponsive applications regularly causing problems? You could probably benefit from making some changes to your Linux computer.

If switching to a lightweight Linux operating system 13 Lightweight Linux Distributions to Give Your Old PC a New Lease of Life 13 Lightweight Linux Distributions to Give Your Old PC a New Lease of Life Read More doesn’t work, you might consider some hardware upgrades. Installing additional RAM is the number one way to give your computer more power, and might be just the thing you need to keep those temperamental apps from becoming unresponsive in future.

So, the next time a Linux application or utility hangs and becomes unresponsive, all you need to do is apply one of these solutions:

  1. Click the X in the corner.
  2. Use the System Monitor.
  3. Use the xkill app.
  4. Employ the kill command.
  5. Close apps with pkill.
  6. Use killall to close software.
  7. Create a keyboard shortcut.

It’s surprising that there are so many ways to kill unresponsive Linux apps — but what’s your favorite? Share it with us in the comments box.

Image Credit: Pepsco Studio via Shutterstock.com

Leave a Reply

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

  1. Debbie
    May 30, 2017 at 2:16 pm

    Lately I have been having an issue which I think might be caused by a sticky key on my keyboard, which is not exactly unresponsiveness, but makes the GUI unusable. I will try to open an application, but instead of starting a single instance, more and more windows will keep opening faster than I can possibly close them. Killing them each individually does not work, because several more will open in the time it takes to kill one. I think Ctrl-Alt-F1, top, and pkill ought to do the trick. Thanks for the great article.

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

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

    wow niceeeeeeeeeeeeeeeeeeee

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

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

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

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

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

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

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

  10. 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
    http://www.linuxhowtos.org/Tips and Tricks/sysrq.htm

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

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

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

      Ctrl + Alt + Esc = KILLL ITTTTTT OFFFFFFFFFFFFFFFFFFFFFFFF

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

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

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

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

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

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

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

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

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

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