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
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.
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.
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.
The Settings window will open up, scroll down to access the Keyboards Shortcut from the side navbar. Click on it.
After that, from the right pane in Keyboard Shortcuts screen click on the plus (+) button.
An Add Custom Shortcut modal will open up. Provide the Name and Command in the relevant fields and click on the Set Shortcut button.
The Set Custom Shortcut modal window will open up. Press the shortcut key you want to set up for the xkill program.
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.
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.
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.
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>
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.
To kill the process, use the following command:
$ kill PID
Or you can also use the name of the process instead of using the ID.
$ pkill <process-name>
To kill all of the process use killall command.
$ killall <process-name>
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.