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

Building RAG with enterprise open source AI infrastructure

One of the most critical gaps in traditional Large Language Models (LLMs) is that they…

11 hours ago

Life at Canonical: Victoria Antipova’s perspective as a new joiner in Product Marketing

Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…

1 day ago

What is patching automation?

What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…

2 days ago

A beginner’s tutorial for your first Machine Learning project using Charmed Kubeflow

Wouldn’t it be wonderful to wake up one day with a desire to explore AI…

3 days ago

Ubuntu brings comprehensive support to Azure Cobalt 100 VMs

Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…

3 days ago

Ubuntu Weekly Newsletter Issue 870

Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…

4 days ago