Categories: Ubuntu

Killing frozen applications in Ubuntu

Sometimes, the applications running on your system freeze and stop responding. A frozen application cannot be closed by simply using the x button in the upper-right corner of the interface, but rebooting the system is not always a good solution—especially if the system is running critical services.

In Ubuntu, there are several methods that can be used to kill frozen applications safely and quickly without rebooting your system: xkill, system monitor utilities, and the commands kill, pkill, and killall. In this article, we will discuss these methods on a machine running Ubuntu 20.04 LTS (Focal Fossa).

Xkill

Xkill is a Linux utility that allows you to kill frozen applications running on Ubuntu. It comes preinstalled in most Linux distributions, but if it is not installed on your system, you can install it as described below.

Sponsored

First, open the terminal using Ctrl+Alt+Del and enter the following command:

$ sudo apt install xorg-xkill

Then, provide a sudo password, and when asked for confirmation, press y, after which the system will start the installation of Xkill. After the installation is finished, xkill can be used to kill unresponsive applications.

To kill a frozen app, simply type xkill in the Terminal:

$ xkill

By doing so, your cursor will become an x. Simply place the x on the application you want to close and click it to close the application immediately.


You can create a keyboard shortcut for xkill by right-clicking your Ubuntu desktop and opening the Settings application.


In the Settings window, select Keyboard Shortcuts from the left pane.


Then in the right pane, click the + button, as shown in the screenshot below.


When the following dialog box appears, specify a user-friendly name for the shortcut in the Name field. Then, in the Command field, type xkill. Next, click the Set Shortcut button to select a shortcut for the xkill utility.


Use any combination of keys to set a shortcut for the xkill utility. For instance, to use Ctrl+k to launch xkill, press and hold and then press the k key. Then, release both keys.


Click the Add button to add your shortcut.


Now, whenever you need to need to kill a frozen application, you can press the shortcut keys to execute the xkill command.

Sponsored

Using the System Monitor

From Ubuntu System Monitor, you can also kill an application. To open System Monitor, press the super key on your keyboard and enter system monitor. When the icon for the System Monitor appears, click it to open it.


In the System Monitor application, there will be a list of processes that are currently running on the system. Select the process you want to kill and right-click it. From the menu that appears, select Kill to kill the selected process immediately.

Using kill, pkill, and killall

Kill, pkill, and killall can be called in the command line to kill an application based on its process name or process ID (PID).

To find the PID, issue the following command in the terminal:

$ ps aux | grep process-name>

For example, in the following output, 34636 is the PID of the Rhythmbox application.

$ ps aux | grep rhythmbox


To kill a process by using its PID, use the kill command as follows:

$ kill 34636

Here, 34636 is the PID of Rhythmbox obtained above.

Alternatively, to kill a process by using its process name, you can use the pkill and killall commands. To use pkill to kill a process, type pkill followed by the process name as follows:

$ pkill rhythmbox


To use killall to kill a process, type killall followed by the process name as follows:

$ killall chrome

Conclusion

As you can see, there are multiple ways to kill a frozen application in Ubuntu. By using any of the above methods, you can easily kill an application that is neither responding nor terminating. Similarly, you can kill an application that is locked by another process.

Ubuntu Server Admin

Recent Posts

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

13 hours ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

1 day ago

Ubuntu Core is now available on MediaTek’s Genio platform

This is the first optimized Ubuntu Core image available on MediaTek’s Genio 350, 510, 700,…

2 days ago

Effective infrastructure automation to reduce data center costs

Data centers are expensive: automation is the solution Today, managing a data center requires striking…

5 days ago

What are our partners building for device makers? Explore the highlights from Ubuntu IoT Day Singapore

Our first Ubuntu IoT Day in Southeast Asia – and our first ever event in…

6 days ago

Fixes available for local privilege escalation vulnerability in libblockdev using udisks

Qualys discovered two vulnerabilities in various Linux distributions which allow local attackers to escalate privileges.…

6 days ago