kill Command in Linux (original) (raw)

Last Updated : 14 May, 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).

Example: Killing the 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

**Output:

kill_mozilla

Step 2: Gracefully Terminate Firefox

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

**Command:

kill 22673

**Explanation:

**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

Step 4: Verify Firefox Termination

Check that no Firefox processes remain:

Command:

ps aux | grep firefox

**Output:

kill_mozilla_verif

Syntax

kill [-signal]

Common Signals Used with the kill Command

Some frequently used signals in the kill command are:

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

**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

**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 you 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

**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

Finding 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 find 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

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

**Example:

kill 6056

2. Force Kill a Process

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

**Syntax:

kill -9

**Example:

kill -9 60142

kill

Force Kill a Process

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

**Example:

kill -STOP 59753

kill2

Pause a Running Process

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

**Example:

kill -CONT 59753