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, 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?
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:
- Go to Applications.
- Search for System Monitor and open it.
- In the Processes window, search for the Application you want to kill and right-click it.
- Select Kill or press Ctrl + K to force quit the app.
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.
- Navigate to settings.
- From the left panel of the settings, go to Keyboard.
- Click on View and Customize Shortcuts.
- Select Custom Shortcuts.
- Click on Add Shortcut.
- In the Name field, assign it an appropriate name. And in the Command field, type
- Now, click on the Set shortcut and press the desired shortcut key for the xkill to activate.
- Finally, click on Add to save changes. This will set the desired shortcut key for the force quit.
- 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 X sign.
- 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
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.
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>
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.
- Press Ctrl + Alt + T to launch the terminal.
xkilland hit enter. The mouse cursor will now change to X.
- Take the cursor over any point of the application window you want to force quit and click on it.
- Finally, the application process will stop in the system.
xkillcommand 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.
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>
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>
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;
- First of all, install the htop using the package manager if it isn’t already installed.
sudo apt-get install htop
- Now, execute the command
- Select the process you want to stop the process.
- Then press F9. You will get options for sending the kill signals.
- Select SIGKILL and press enter.