6 Different Ways To Kill Unresponsive Programs in Linux

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.

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

Ads by Google

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?

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Best Linux Apps
Best Linux Apps
19 Members
Linux for New Switchers
Linux for New Switchers
25 Members
Linux Distros Talk
Linux Distros Talk
12 Members
Master the Linux Command Line
Master the Linux Command Line
15 Members
Ads by Google
Comments (28)
  • rain

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

  • ewqtrwerw

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

  • khinch

    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!

  • Einheit

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

  • bhagya

    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

      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.

Load 10 more
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.