How to Force Quit an App on Linux

Sometimes when the app is not responding, you cannot close it by clicking the normal close tabs. In such cases, you must force quit such applications. 

Moreover, Linux is one operating system platform that gives multiple options for you to terminate the applications and system processes. Linux users can use the terminal, and system monitor, and even add custom keyboard shortcuts, which makes it very convenient to force quit unresponsive apps. 

In today’s article, we will go through different processes to force quit apps on Linux using different command lines and Graphical interface tools. 

How to Force Quit an App on Linux

How to Force Quit an App on Linux?

There are different CLI and GUI-based methods to force kill an app on Linux. The easiest method to force quit an app is from the System monitor utility and the Xkill command. There are other advanced tools as well that you can use for this purpose. We will discuss them in detail in this article. 

Force Quit an App on Linux With GUI

Some Linux distros like Ubuntu and Mint provide GUI applications to overview the system processes. These applications can be used to manage the system process and, additionally, to force quit the apps.  

Using System Monitor App

In some distros that use GNOME Desktop Environment, a system process monitoring app is provided called System Monitor App, which is similar to Windows’s Task Manager. Users can force quit an app using this application. 

Here is how to do it:

1- Go to Applications.

2- Search for System Monitor and open it.

See also  Using Terminal to Enable Airplane Mode in Linux: A Step-by-Step Guide

3- In the Processes window, search for the Application you want to kill and right-click it.

4- Select Kill or press Ctrl + K to force quit the app.

Note: If the system monitor app is not installed in the system, enter this command in the terminal to install it.  sudo apt-get install gnome-system-monitor

Using Keyboard Shortcut

You can also set a certain keyboard shortcut to quit an app running in the system. There is a feature to add keyboard mapping to initiate this.  Here is how you do it.

1- Navigate to settings.

2- From the left panel of the settings, go to Keyboard.

3- Click on View and Customize Shortcuts.

4- Select Custom Shortcuts.

5- Click on Add Shortcut.

6- In the Name field, assign it an appropriate name. And in the Command field, type xkill.

7- Now, click on the Set shortcut and press the desired shortcut key for the xkill to activate.
 

8- Finally, click on Add to save changes. This will set the desired shortcut key for the force quit. 

9- Now, to force quit any app, press the Keyboard button you have assigned (For example, Shift Ctrl Esc). Your mouse cursor will then change into an sign.

10- Hover the mouse cursor over the app’s window and click on it to force quit the application.

Force quit an App on Linux With Commands

You can use multiple command lines in Linux to manage the system processes. Additionally, some commands such as xkillkillall, and htop make it very easy to terminate the process in a go. We will go through some of these CLI tools you can use in Linux to force quit an app.

See also  Steps to Add Applications to the Ubuntu Desktop 23.04

Before using the commands for the force stop, it is necessary to know about the process id. Each running process on Linux has an id you can use while terminating it. In order to determine the process id, you can use the pidof command. Use the syntax with the following format, along with its use case and output as shown in the screenshot.
 pidof <Process Name>

If you are unaware of the exact process name, use the ps command to determine it.
ps aux | grep -i <process name>

Using Xkill

If you use the xkill feature, it will change the mouse cursor to X, which you can place over an application window and click on it to end its processes.  Earlier, we mentioned a process to map the keyboard to activate the xkill command. However, you can also use this command from the terminal. Follow these steps to use it.

1- Press Ctrl + Alt + T to launch the terminal.

2- Type xkill and hit enter. The mouse cursor will now change to X.

3- Take the cursor over any point of the application window you want to force quit and click on it. 

4- Finally, the application process will stop in the system. 

Note: The xkill command is not installed by default on Linux and only works on Xorg sessions. You would have to install it using the package manager. Use this command to install it.  sudo apt-get install xorg-xkill

Using Kill command 

Kill command is a useful tool to terminate the system processes or applications running on Linux. The kill command uses the process id of the application and signals it to terminate the processes from the system.

See also  How to Change Boot Order on Linux

Here is the syntax for the command, along with its use case in the screenshot. 
sudo kill -9 <process_id>

If you have multiple processes to close, you can enter their process id into the single kill command line to force stop them at once. Here is the syntax for it.
sudo kill -9 <processid1> <processid2>< processid3>

Using Killall

If you know the application’s process name, you can directly use the killall command to terminate the application from the system. Use this syntax for it. 
killall <process name>

Using Htop 

htop is the command line that lets users monitor the terminal’s system processes and manage them. The latest alternative to the top command allows you to force quit the application and processes in the Linux OS quite efficiently. To use the htop command line, follow these steps;

1- First of all, install the htop using the package manager if it isn’t already installed.
sudo apt-get install htop

2- Now, execute the command htop

3- Select the process you want to stop the process.

4- Then press F9. You will get options for sending the kill signals.

5- Select SIGKILL and press enter. 

End.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1273

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *