kill Command in Linux

Last Updated : 9 Mar, 2026

The kill command in Linux is used to send signals to processes in order to control their execution. It is commonly used to terminate processes, but it can also pause, resume, or perform other actions depending on the signal sent. The kill command sends signals to processes using their Process ID (PID).

  • Located in /bin/kill , it’s a built-in Linux command.
  • Sends specific signals to processes using their Process ID (PID).
  • By default, it sends the SIGTERM (15) signal to terminate a process.
  • Can use other signals like SIGKILL (9) or SIG STOP (19) for different actions.

Example: Killing Mozilla Firefox Process

Terminate the Mozilla Firefox browser process when it becomes unresponsive or needs to be closed from the terminal.

Step 1: Identify the Firefox PID

Check the running Firefox processes and their PIDs.

Command:

ps aux | grep firefox
  • ps aux: Lists all running processes with details.
  • grep firefox: Filters processes related to Firefox.

Output:

kill_mozilla
  • 22673: Is the main Firefox process PID. Other Firefox processes listed are child processes associated with it.

Step 2: Gracefully Terminate Firefox

Send the SIGTERM (15) signal to allow Firefox to close properly.

Command:

kill 22673

Explanation:

  • 22673 is the PID of the main Firefox process.
  • The default SIGTERM signal requests a graceful shutdown.
  • Child processes typically terminate automatically along with the parent process.

Output:

kill_mozilla_prcs

Step 3: Force Kill Firefox (if it doesn’t close)

If Firefox is unresponsive, use SIGKILL (9) to terminate it immediately.

Command:

kill -9 22673
  • -9: Sends the SIGKILL signal. Forces the process to stop immediately without cleanup.

Step 4: Verify Firefox Termination

Check that no Firefox processes remain:

Command:

ps aux | grep firefox

Output:

kill_mozilla_verif
  • Only the grep command appears. No active Firefox processes remain, confirming termination.

Syntax

kill [signal] <PID>
  • [signal]: Optional signal specifying the action by either a number (like -9, -15) or a name (like -KILL, -TERM, -STOP).
  • PID: The Process ID of the target process.

Common Signals Used with the kill Command

Some frequently used signals in the kill command are:

  • SIGHUP Hangup (1): Sent when the controlling terminal is closed or the parent process ends. Often used to make a process reload its configuration without stopping it.
  • SIGINT Signal Interrupt (2): Sent when you press Ctrl+C in the terminal. It interrupts a running process and asks it to stop gracefully.
  • SIGKILL Kill Signal (9): Forcefully terminates a process immediately. The process cannot ignore this signal. Used when a program is unresponsive.
  • SIGTERM Terminate Signal (15): Requests a process to terminate gracefully, allowing it to clean up resources such as open files. This is the default signal used by the kill command.
  • SIGCONT Continue Signal (18): Resumes a paused process that was previously stopped using SIGSTOP.
  • SIGSTOP Stop Signal (19): Pauses or suspends a process temporarily without terminating it. Can be resumed later with SIGCONT.

Different Ways to Send Signals with kill

Signals can be specified in three ways; they are as follows:

1. Using Signal Number

We can specify a signal using a number. For example, we have a PID `1212` and want to send a `SIGKILL` signal to kill this PID. SIGKILL has a signal number of `9` (To find signal numbers run `kill -l` command).

Syntax:

kill -9 <PID>
  • -9: Signal number for SIGKILL (force termination).
  • <PID>: Process ID of the target process.

Command Example:

kill -9 1212

Expected Output:

(no output if successful)

Note: SIGKILL immediately stops the process. The process cannot ignore or handle this signal.

2. Using Signal Names with SIG Prefix

We can also specify signal using SIG prefix. For example, we need to send a signal `SIGTERM` and PID is `1432`. To just check signal number of `SIGTERM` signal we can use `kill -l` command.

Syntax:

kill -SIGTERM <PID>
  • -SIGTERM: Signal name with SIG prefix.
  • <PID>: Process ID of the target process.

Command Example:

kill -SIGTERM 1432

Expected Output:

(no output if successful)

Notes: SIGTERM allows the process to clean up resources before exiting. This is the default signal used by kill.

3. Using Signal Names Without SIG Prefix

We can also specify signals without using SIG prefix. For example, if want to send signal `TERM` and PID `1234`. To just check signal number of `TERM` signal we can use `kill -l` command.

Syntax:

kill -TERM <PID>
  • -TERM: Signal name without SIG prefix.
  • <PID>: Process ID of the target process.

Command Example:

kill -TERM 1234

Expected Output:

(no output if successful)

Notes: Linux allows both -SIGTERM and -TERM formats. Both commands send the same signal.

Options in kill Command

There are different types of options used in the kill command.

1. kill -l

The kill -l command lists all available signals that can be used with the kill command.

Syntax:

kill -l

Output:

kill -l
kill -l

How to Find a Process ID (PID)

The kill command is used when we know the process ID (PID) of a running process. To use kill, we must first find the PID of the process we want to stop or control. This can be done using commands like ps, pidof, or top.

Method 1. Using ps command

by using ps command to know the process ID.

Syntax:

ps

Output:

ps
ps

Method 2. Using top command

The 'top' Command in Linux is a dynamic, real-time utility that provides a detailed overview of system performance. It displays critical information such as CPU usage, memory utilization, process activity, system load averages, and more, making it an essential tool for monitoring and managing system resources efficiently.

Syntax:

top

Output:

top

The top command show all the process ID and their Process Name running on the system.

Practical Process Control Examples

1. Gracefully Terminate a Process

This option specifies the process ID of the process to be killed.

Syntax:

kill <process ID>

Example:

kill 6056

2. Force Kill a Process

To terminate a process immediately using the signal 'SIGKILL' or signal number '9'.

Syntax:

kill -9 <PID>

Example:

kill -9 
kill

This process ID belongs to a text editor, so we forcefully terminated it using kill -9.

3. Pause a Running Process

To pause (stop/suspend) a running process without terminating it, you can send it the SIGSTOP signal using the kill command:

Syntax:

kill -STOP <PID>

Example:

kill -STOP 59753
kill2

4. Resume a Paused Process

If you have previously paused a process using kill -STOP, you can resume it by sending the SIGCONT signal.

Syntax:

kill -CONT <PID>

Example:

kill -CONT 59753
Comment

Explore