Having issues with an ongoing process in Linux?
In any operating system, the programs and applications running are known as processes. Each running task or process uses the resources provided by the system. These include the RAM, processor, and a permanent storage device such as an SSD, etc.
These processes usually function properly, but like any other process in the world, they can sometimes malfunction. They might stop working or cause problems to other correctly working processes.
In other cases, too many processes running in the background utilize a lot of resources and end up slowing down the whole system as a result. In such situations, it is best to terminate the processes that are causing these interferences.
There are different ways to end an unresponsive program for different operating systems. You may be familiar with the Task Manager for Windows. Linux provides us two different ways we can ‘kill’ a process. One is the
kill command we can use on the Terminal. The other is the System Monitor.
If you are using Linux and are in a sticky situation with one of your applications, this article will guide how to kill a process on Linux.
So, buckle up and get ready!
The Kill Command.
As you know, the Terminal can be used to do anything with your computer. To end a process, there is a very convenient kill command. To learn how to kill a process on Linux using the kill command, we must first understand its syntax. The syntax for the command is:
$ kill -signal PID
The two parts of the syntax need explanation.
The Signal is a number representing a signal name. Kill performs different tasks according to the signal you provide it. There are a total of 64 signals associated with
kill, and to view all of them use the following command:
$ kill -l
In the above image, you can see the 64 signals. From these 64 there are only two signals that are used commonly with
SIGKILL(9): It kills the process without saving any data, usually used as the last resort.
SIGTERM(15): It terminates the process in a safety-first way. This is the goto signal for ending a process.
Moving forward, there are three ways you can specify a signal:
- By Number:
$ kill -9 PID
- By Signal Name:
$kill -sigkill PID
- By Name without ‘sig’:
$ kill -kill PID
This is all the information you needed to know about the signals related to
The Process Identification Number (PID) is the identification number given to each process in Linux. The knowledge of PID of the given process is important, without it, you can’t kill the process. There are two commands that you can use for this purpose.
$ pidof <process name>
$ pgrep <process name>
For example, we will use both these commands to know the PID for the currently running Mozilla Firefox.
1. Kill a Process Using Terminal.
With the signal and PID parts of the syntax explained, it is fair to say that you now have learned all the basics related to the kill command. You should now test these basics. The following steps will guide you on how to kill a process on Linux using the terminal:
- Open the Command Terminal.
- Type any of the two mentioned commands to get the PID of your process.
$ pidof <process name>
$ pgrep <process name>
- Now that you have the Process Identification number, the next step is to kill the process.
$ kill -15 <PID>
$ kill -sigterm <PID>
$ kill -term <PID>
- As mentioned before, it is better to use
SIGTERMfor killing the process. If it doesn’t work out, use
SIGKILLto end the misery once and for all.
$ kill -9 <PID>
- You can also end multiple malfunctioning processes using a single
killcommand in this manner.
$ kill -15 <PID1 PID2 PID 3……. PIDN>
- You also have the choice of using
pgrepcommand in the same line to end the process.
$ kill -15 pidof <process name>
These are the steps you have to follow to
kill a process using the Terminal successfully. You can use any commands listed above according to your liking, you will get the same result. Now we move on to the second method of killing a process in Linux.
2. Kill a Process Using System Monitor.
The System Monitor is the Linux version of Task Manager, which is affiliated with Windows. This application lists all of the currently running processes on your Linux system, similar to what the Task Manager does on Windows.
Using the System Monitor, we can easily end the malfunctioning process using a single click. There is no need to find the PID of that task, nor is it required to type the
So, to kill a process using the System Monitor, follow these steps:
- Search for ‘System Monitor‘.
- Open the System Monitor application.
- Once it is opened, you can see all of the running processes.
- Choose the one that is causing you trouble. When you click on the process name. The End Process option should pop up at the bottom of the application window.
- Click on the End Process option.
- The process gets terminated, and you can no longer see it in the list of running processes.
There are various instances where a user can get stuck with a program malfunction using a computer. It is, after all, not a perfect machine. But then again, there is nothing in this world that can be called outright perfect. This article addressed this problem and attempted to guide you on how to kill a process on Linux.
Facing such problems is very common, no matter which device or operating system you use. The great thing is, the operating systems have given you methods to manually override the malfunctioning programs. The kill command and the system monitor are the two ways you can end processes in Linux.
Speaking of Linux, if you want to perform a reverse DNS lookup on the operating system, this article should guide you thoroughly.
If this guide helped you, please share it. 🙂