Knowledgebase Home / How to kill processes in Linux using kill, killall and pkill

How to kill processes in Linux using kill, killall and pkill

In this article, we will show you how to use kill, killall, and pkill commands to terminate a process in Linux. A process is the running form of a program that is currently being executed. Programs are stored on disk and processes run in memory.  

The main difference between these tools is that kill terminates processes based on Process ID number (PID), while the killall and pkill commands terminate running processes based on their names and other attributes.

System Kill Signals

Signals are a form of a dialogue between the processes that can come from other processes, the kernel, or the process itself. These kill, killall, and pkill commands send a given signal to the mentioned processes or process groups. If there are no signals provided, each tool sends 15 (TERM).

Few of the commons signals used are as follows.

  • 1 (-HUP): to reload a process.
  • 9 (-KILL): to kill a process.
  • 15 (-TERM): to gracefully stop a process.

Signals can be specified in three different ways

  • using a number (e.g., -1)
  • with the “SIG” prefix (e.g., -SIGHUP
  • without the “SIG” prefix (e.g., -HUP).

Let us review those 3 ways to kill a process using commands.

Steps are as follows:

1. Kill Command – Kill the process by specifying its PID

The common syntax for kill command is:

# kill [signal or option] PID(s)

However, to terminate a process with the kill command first, you need to find the process PID. The simplest way to find this is either using commands like top, ps, pgrep or pidof.

Example on how to find a PID of a process using pidof command.

Let’s assume that we need to kill the firefox process running on a Linux system.

pidof firefox

This command will print all the firefox process PIDs.


2550 2410 1260 1850 1770

The kill command you will need to execute the next would be as follows.

kill -9 2550 2410 1260 1850 1770

2. killall Command – kill the processes by name. By default, it will send a TERM signal. The killall command can kill multiple processes with a single command. If more than one process runs with that name, all of them will be killed.

# killall [process]

Example: Kill all the firefox processes

killall -9 firefox

3. Pkill Command – Send signal to the process based on its name. You can send signal to any process by specifying the full name or partial name. So there is no need for you to find out the PID of the process to send the signal.

pkill [options] pattern

Simply, type pkill with the process name that you want to kill as input. You must be aware of the process name before killing and entering a wrong process name may screw you.

Example: Kill all the MySQL processes

pkill mysqld


Congratulations, you have learned how to use kill, killall and pkill commands on a Linux system to kill processes

If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look.

Our Guiding Principles

  • Provide consistent, stable and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.