---
title: How to Identify and Kill a Running Process in Linux
description: "In Linux, managing processes is a key part of system administration. You can identify and terminate (or \"kill\") processes using several commands. Here’s a guide on how to identify and kill a running process on a Linux server. ## 1.…"
url: "https://truehost.com/support/knowledge-base/how-to-identify-and-kill-a-running-process-in-linux/"
updated: "2024-10-30"
category: Cloud servers in Kenya
---

# How to Identify and Kill a Running Process in Linux

In Linux, managing processes is a key part of system administration. You can identify and terminate (or "kill") processes using several commands. Here’s a guide on how to identify and kill a running process on a Linux server.

## 1. **Identify a Process by Name or ID**

The first step is to identify the process you want to stop. This can be done using commands like `ps`, `top`, `htop`, and `pgrep`.

#### Using `ps` Command

The `ps` command shows a snapshot of current processes.

- **List all processes**:
  - Note the PID of the process that you want to kill

```
ps aux
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-659.png)

- **Find a specific process by name**:
  - Replace `process_name` with the name of the process you're searching for.
  - Take note of the PID

```
ps aux | grep process_name
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-660-1024x137.png)

#### Using `top` Command

`top` provides a real-time view of running processes and can help you identify high-resource-consuming processes.

- **Start `top`**:
  - Note the PID of the process you want to kill.
  - Press `q` to quit `top`.

```
top
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-661-1024x363.png)

#### Using `htop` (if installed)

`htop` is an interactive tool that provides an easy-to-use interface for managing processes.

- **Start `htop`**:

```
htop
```

- Navigate to the process and press `F9` to kill it.

![](https://truehost.com/support/wp-content/uploads/2024/10/image-662-1024x552.png)

## 2. **Kill a Process by PID**

Once you’ve identified the PID of the process, you can use the `kill` command to terminate it.

- **Basic kill command**:
  - Replace `PID` with the actual process ID.

```
kill PID
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-663.png)

- **Common Kill Signals**

The `kill` command uses different signals to terminate a process:

- **SIGTERM (signal 15)**: Politely asks a process to stop.
  - If you input a PID that does not exist, you will see an output that says there is no such process.

```
kill -15 PID
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-664.png)

**SIGKILL (signal 9)**: Forces a process to stop immediately, without cleanup.

```
kill -9 PID
```

## 3. **Kill All Instances of a Process by Name**

To kill all instances of a particular process by name, use the `pkill` or `killall` commands.

#### Using `pkill`

`pkill` can terminate processes based on their name.

- **Kill processes by name**:

```
pkill process_name
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-665.png)

#### Using `killall`

`killall` kills all instances of a process by name. This is useful for stopping multiple instances.

- **Kill all instances of a process**:

```
killall process_name
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-666.png)

## 4. **Check if the Process was Successfully Terminated**

Use either of the commands below to check if the process is still running.

```
ps aux | grep process_name or pgrep process_name
```

![](https://truehost.com/support/wp-content/uploads/2024/10/image-667.png)

![](https://truehost.com/support/wp-content/uploads/2024/10/image-668.png)

## Summary of Commands

- **Identify Process**:
  - `ps aux`
  - `pgrep process_name`
  - `top` or `htop`
- **Kill Process by PID**:
  - `kill PID`
  - `kill -9 PID` (force kill)
- **Kill All by Name**:
  - `pkill process_name`
  - `killall process_name`

These commands provide an efficient way to identify and kill processes on Linux, essential for effective system management and troubleshooting.
