How to Kill a Process on Linux

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 makes use of 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.

How to Kill a Process on Linux

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 the very convenient kill command. To learn how to kill a process on Linux using the kill command, we need first to understand its syntax. The syntax for the command is:

$ kill -signal PID

The two parts of the syntax need explanation.

1. Signal.

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
How to Kill a Process on Linux

In the above image, you can see the 64 signals. From these 64 there are only two signals that are used commonly with kill:

  1. SIGKILL (9): It kills the process without saving any data, usually used as the last resort.
  2. 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:

  1. By Number:                       $ kill -9 PID
  2. By Signal Name:                $kill -sigkill PID
  3. By Name without ‘sig’:       $ kill -kill PID

This is all the information you needed to know about the signals related to kill.

2. PID.

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. 

How to Kill a Process on Linux


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:

  1. Open the Command Terminal.
  2. Type any of the two mentioned commands to get the PID of your process.
$ pidof <process name>
$ pgrep <process name>
get the PID
  1. 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>
Process Identification number
  1. As mentioned before, it is better to use SIGTERM for killing the process. If it doesn’t work out, use SIGKILL to end the misery once and for all.
$ kill -9 <PID>
  1. You can also end multiple malfunctioning processes using a single kill command in this manner.
$ kill -15 <PID1 PID2 PID 3……. PIDN> 
How to Kill a Process on Linux
  1. You also have the choice of using kill and the pidof or pgrep command in the same line to end the process.
$ kill -15 pidof <process name>
How to Kill a Process on Linux

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 kill command. 

So, to kill a process using the System Monitor, follow these steps:

  1. Search for ‘System Monitor‘.
How to Kill a Process on Linux
  1. Open the System Monitor application.
  2. Once it is opened, you can see all of the running processes.
How to Kill a Process on Linux
  1. 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.
ending a process
  1. Click on the End Process option.
  2. The process gets terminated and you can no longer see it in the list of running processes.
How to Kill a Process on Linux

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 are using. 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. 🙂

Leave a Reply

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

Previous Post

How to Use NGREP Command in Linux

Next Post

How to Cancel Playstation Plus Subscription

Related Posts