A simple tutorial demonstrates how to find a running process ID and kill it using the terminal and GUI method for various Linux distros.
The running applications in your Linux system can slow down your system, especially if you have a low-end system. In Linux (plus all OS), programs or apps contain a specific PID (process ID) by which you can identify them easily.
However, as a beginner, many Linux users don’t know how to find a running process in Linux and kill it. So in this guide, we will explain different approaches to kill the currently running processes in Linux. That includes the terminal and GUI methods.
Remember, you should only kill the process when it is not responding, or you are in a situation where the normal application closing is not working (for GUI-based apps).
Table of Contents
How to find process id and kill them in Linux
In this section, first, let’s learn the method to find the PID of a running process and then commands to kill them:
Find the Currently Running Process
You can use the
top command to list the currently running process with their PID and other details. The top program is installed by default in all Linux distros and all Unix-based systems.
Similarly, you can run the
ps command with additional options to get the PID of a specific process. For example, you can use the following command to get the PID of
ps -el | grep -i firefox
Now that you have found the process id, let’s see how you can kill it.
Kill the Running Process
You can either use the process name or PID to kill the currently running process using the following commands:
- killall: Kill a process using the name of a running process
- kill: Kill the process with PID
Now, first, let’s use the
killall process to kill Firefox with its name, and here is the command:
killall -9 firefox
- The parameter
-9sends the SIGKILL signal to the OS to terminate the process.
- You can also list down several other signals using the following command.
Similarly, if you want to kill the process from the process ID, you can use the command given below:
kill -9 <PID>
For this example, the command would be:
kill -9 33665
Let’s see how you can kill any process or application using the graphical user interface (GUI) in various distros.
Find process id to kill via GUI
There are many graphical programs available to list down processes. Most Linux distribution ships it as part of their desktop environment. Here are some of them.
GNOME (In Ubuntu, Fedora workstation, etc.) & in Linux Mint
Search for “system monitor” in the application menu and open it. On the processes tab, find your process. Right-click on the process name to bring up the context menu and choose the option kill.
KDE Plasma (Kubuntu, Fedora-KDE or any Plasma-based distro)
From the application menu, search and launch “system monitor”. This will launch the following program. From the left side, click on Processes, and you should see a list of programs running. You can right-click on the process/application and select Kill to terminate the process.
The native application for this task on the Xfce desktop is Task Manager, which you can launch via
Application > System > Task manager. Right-click on the process name and select kill to terminate the app or process.
Other desktops or distros to kill a process pr program
If you can’t find anything similar, you can choose the terminal method. Or, you can install the gnome-system-monitor using the following commands.
For Ubuntu and related distros
sudo apt install gnome-system-monitor
In Fedora and related:
sudo dnf install gnome-system-monitor
And in Arch Linux:
sudo pacman -S gnome-system-monitor
So this is how you can find a running process id in Linux and kill it. We have explained different approaches that you can try to kill the process either from its name or PID. I hope this helps.