At times, in a computer system when applications are running the system might freeze and does not respond. This seems annoying since users are not even able to close the program by using the X icon on the UI of the application. This is because the processes/applications are not responding and they will not simply be closed by the UI method. Even continuous rebooting of your system does not seem to be a suitable solution. Sometimes, users have many critical data that could be unsaved. There are solutions to such problems that are easily adaptable and will cover them in this article.

In Ubuntu, there are many methods used to kill such frozen applications in which users are not required to reboot their systems. xkill, and system monitor utility are the famous methods used along with kill, pkill, and killall commands. In this article, I will show you 3 different ways of killing frozen applications on an Ubuntu 20.04 system using GUI as well as the command line.

Method 1: By using xkill

The utility allows users for killing the frozen applications on Ubuntu. It is installed by default in your system, but in case if not then you can follow the method discussed in the next section to install xkill.

Installation of xkill

Open up the terminal window using the Ctl+Alt+T shortcut and then append the following command in the CLI:

$ sudo apt install xorg-xkill

Install xkill

If asked, provide the sudo password of the logged-in user. In case, if the system prompts you to ask for the confirmation then press the Y key from the keyboard and hit enter to proceed. xkill is the utility to kill all frozen applications.

In order to kill any frozen application, you need to type xkill in the command line.

Run xkill

As soon as you press the <enter> key from your keyboard, you will notice that the cursor will become an x. To utilize this, you have to place x on the application you desire to close.

Killing frozen apps using xkill

Creating a shortcut for xkill

For the ease of the users, we will learn how to create the keyboard shortcut for xkill. Go to the Settings of your system.

Settings

The Settings window will open up, scroll down to access the Keyboards Shortcut from the side navbar. Click on it.

Keyboard Shortcuts

After that, from the right pane in Keyboard Shortcuts screen click on the plus (+) button.

Add Shortcut

An Add Custom Shortcut modal will open up. Provide the Name and Command in the relevant fields and click on the Set Shortcut button.

Xkill shortcut

The Set Custom Shortcut modal window will open up. Press the shortcut key you want to set up for the xkill program.

Choose key combination

Once selected, click on the Add button. Here, the shortcut we chose for our program is Ctl+K, you can choose any one as per your convenience.

xkill shortcut: ctrl + k

Now, you can use the xkill process by pressing the shortcut keys from your keyboard.

Method 2: By using System Monitor

In Ubuntu, users can kill any process by using the System Monitor. Open up the System Monitor by accessing the Applications. Once you have entered the system monitor you will see a list of running processes.

Ubuntu System Monitor

Right-click on any of the programs you want to kill. A drop-down menu containing multiple options will appear. Click on the Kill button against the program that is not responding. The application/process will be killed successfully.

Process list

Method 3: By using the system commands

In Ubuntu, we have many commands that are used to kill any process. Kill, pkill, and killall being one of them are used to delete the program by using its process name or ID of the process (PID).

Now, you must be wondering how to find out the PID. That’s not a problem, simply type the following command in the command line. Remember the process we selected in the previous method, as an example we are using the same name. You can replace this field as per your requirement.

$ ps aux | grep <process-name>

Find process by name

The process information will be returned similar to the one displayed below. We also get the process ID in response. It is 1447 in our case.

Process list on the shell

To kill the process, use the following command:

$ kill PID

Kill a process using kill command and its process id

Or you can also use the name of the process instead of using the ID.

$ pkill <process-name>

Use pkill command

To kill all of the process use killall command.

$ killall <process-name>

killall command

Conclusion

In this article, we covered all possible solutions to one common problem of frozen application in the Ubuntu 20.04 system. The methods can be used to kill a process that is either not responding or is locked by any other type of process.

Killing frozen applications in Ubuntu 20.04
Avatar

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.