While using Ubuntu, one or more of our processes and applications might hang out from time to time. Restarting our system is not always the optimal solution and we find ourselves looking for ways through which we can quickly, easily, and safely get rid of the unresponsive applications and programs. In this article, we will explain various ways through which you can get rid of these unresponsive or hanging applications on your Ubuntu both through the UI and the command line.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system. Some of the below-mentioned methods include the use of the Ubuntu command line, the Terminal. You can open the Terminal application either through the system Dash or the Ctrl+Alt+T shortcut.

Method 1: Using the X button for unresponsive UI based applications

If one of your UI based application is taking much longer than expected to respond or it is in a hanging state, you will see that it’s UI and buttons have become greyed out. If you see the “x” button, that is used to close applications, in an active state, you can try to kill the application dead through it.

Using the X Button

In some distros, you will be prompted to send an error report when you try to close the unresponsive option. In others, you might be given an option to wait or ‘force quit’ the app. Whatever the case might be, there are high chances that you will be able to get rid of the unresponsive program.

Method 2: Using the System Monitor, Ubuntu’s Task Manager

Just like the Windows Task Manager that you might be using for years, Ubuntu also comes with a built-in processes & resources monitoring utility called the Gnome System Monitor. This Ubuntu task manager allows you to kill, end, stop and resume processes on your Ubuntu.

You can launch Gnome System Manager through the UI any time you want by searching for system monitor or even task manager in the Ubuntu Dash, or otherwise access it directly from the Applications list.

Start system Monitor

In the Processes tab of the System Monitor, you will be able to see all the currently running processes, also including the unresponsive ones. In order to kill a process, simply right-click on it and then select the Kill option.

Process list

However, we recommend that you first try to shut off the process by using the Stop or End options as they are relatively safer ways to discontinue it.

Method 3: Using the xkill utility

There is a Linux utility called xkill that can be used to kill an unresponsive program through your desktop. Most latest Linux distros have it installed by default but if your system lacks it, you can install it by using the following command in your Terminal:

$ sudo apt-get install xorg-xkill

Please note that only an authorized user can add/remove and configure software on Ubuntu.

Now run this utility by using the xkill command as follows:

Start xkill

After running this command, you will see that your mouse pointer will turn into an ‘x’ or a skull. You can simply take the pointer to the unresponsive program and click it there. This will kill the hanging program within seconds.

Creating a Keyboard shortcut for xkill

While xkill is a very effective way to kill hanging programs, it might seem a hassle to open the Terminal and then run the command. Let us present the quickest way through which you can use this utility. How about creating a customized keyboard shortcut that simply runs the command for you and you are able to see and directly use the ‘x’ shaped pointer to kill an application. Here is what you need to do:

1. Open the Keyboard Shortcuts Settings

Open the Ubuntu Settings utility and access the Keyboard settings through the Devices tab. The easiest way to open the Keyboard settings is by searching for “keyboard shortcuts” through the Dash search.

Open Keyboard Shortcuts

The Settings utility will open in the following view:

Keyboard Shortcut list

2. Creating a custom shortcut

Scroll down through the slider located on the right side and you will be able to see a ‘+’ button at the bottom of the list. Click on that button in order to add a new custom shortcut. The Add Custom Shortcut dialog will appear. Enter the following information after which the Add button will become active:

Name: xkill

Command: xkill

Add custom shortcut

Then click on the Set Shortcut button which will let you set a keyboard shortcut for the entered command:

Enter new shortcut

Press the key combination of your custom shortcut. I am entering Ctrl+Alt+K as the shortcut as it is already not being used by my system for some other purpose. Also because the K in the combination is relevant to the word “Kill”.

Anyway, after entering the key combo you will see it listed in the Shortcut field of the Add Custom Shortcut dialog as follows:

Add xkill shortcut

All you need to do now is click the Add button and your new keyboard shortcut is registered as the new custom shortcut.

Now try using the new shortcut and you will be able to see the ‘x’ or a skill shaped mouse pointer at your service.

Method 4: Using the kill, pkill and killall commands

Let us assume that our Ubuntu Software Manager, the Gnome Software, is stuck. We can use the command line based system monitor, the top command, in order to get information about the currently running processes as follows:

$ top

List of processes shown in top command

Here you can get useful information about the Gnome Software application such as the PID (process ID) that can be used to kill the process.

You can then use the kill command as follows to kill the process using it’s PID:

$ kill [PID]

Example:

Use kill command

  • You can also use the pkill to kill the process by using the following syntax:
$ pkill [ProcessName]

Example:

Using pkill to kill a process

  • Then comes the killall command that you can use to kill all the instances of an application. Here is the syntax:
$ killall [ProcessName]

Example:

Using Killall command

Now no matter which one of your UI or even CLI based application gets stuck and won’t respond even if given time, you have a list of ways to get rid of it. You can use both the UI or the command-line based approaches mentioned in this article to be on the go again, almost immediately.

4 Ways to Kill Unresponsive Applications in Ubuntu