> ## Content Index
> Fetch the complete content index at: https://blog.alphavps.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Find and Kill High CPU Processes on VPS
- URL: https://blog.alphavps.com/how-to-find-and-kill-high-cpu-processes-on-vps/
- Published: 2025-12-04T10:21:42.000Z
- Updated: 2026-09-08T15:18:12.000Z
- Author: Karim Buzdar
- Tags: Tutorials, Monitoring & Logs, Linux Basics, #series-performance-tools

Running a VPS gives you the freedom of control, but it also adds to your accountability regarding performance issues. One of the most common performance issues you can encounter is if a single process at some point in time has consumed too many CPU cycles. A high-CPU process can negatively affect your applications, cause slow response times or services to crash altogether. 

In particular, consistent spikes can sometimes result in constant resource consumption and an unexpected billing situation. Being able to effectively find and kill any high CPU processes on a VPS quickly will help keep your server functioning normally. 

Identifying high-CPU processes in either a VPS, live production instance, or in a small personal server has a few distinct commands and steps that are very basic in nature. This document is useful, as it describe simple steps that anyone that doesn't have intense backgrounds in server management can follow with open access to a terminal command line interface through an SSH connection for a few initial steps. 

In this guide, you will learn how to identify CPU-consuming processes, and what goes into determining whether that process should be terminated or stopped. You will also learn how to ensure that the process is safely terminated. We will also discuss methods of preventing the same situation from occurring again, as well as some basic monitoring tools.

### Prerequisites

This guide applies to Debian- and Ubuntu-based VPS environments.  
Before you begin, make sure you have:

- A VPS with SSH access and sudo privileges.
- Basic familiarity with running commands in the terminal.
- The following packages installed:`sudo apt update  
sudo apt install -`y htop sysstat psmisc  
*Note:*
  - `sysstat` provides tools like `pidstat`, `sar`, and `iostat`.
  - `psmisc` includes `killall`, which is used later in this guide.

## **Immediate Checks for Your VPS**

When your VPS feels unresponsive, you don’t always need advanced tools right away. A few quick checks can help you confirm whether the issue is temporary or if deeper investigation is required.

### **Check overall system load**

The uptime command gives a quick overview of how long the system has been running along with the current load averages:

```bash
uptime
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-0c77676c-9c6c-4519-82fc-e27f71019985.png)

If the load average is consistently higher than the number of CPU cores, your server is under significant stress.

### **Check memory pressure**

High CPU usage is sometimes a side effect of memory shortages. The free command shows available RAM and swap usage in a human-readable format:

```bash
free -h
```

If free memory is very low or swap usage is high, processes may be competing for resources, making CPU usage appear higher.

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-ce5af192-dd3d-41a6-b01a-645a39746ff0.png)

### **Get a quick CPU/IO snapshot**

The vmstat command provides a compact summary of CPU, memory, and I/O activity over short intervals.

```bash
vmstat 2 5
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-154ea0a9-877f-4548-8bad-f0343471662f.png)

This prints statistics every 2 seconds for 5 runs. Pay close attention to the wa (I/O wait) column; high values mean the CPU is often stalled while waiting on disk operations.

## **How to Quickly Detect High-CPU Processes**

When a VPS slows down due to CPU spikes, the first step is to identify which processes are consuming resources. Linux provides several tools for this purpose, ranging from interactive monitors to static snapshots and historical analysis.

### **Using top**

The top command is the default monitoring tool available on almost every Linux distribution. It provides a real-time, continuously updated list of processes with details like CPU usage, memory consumption, and process IDs. This makes it the fastest way to see which tasks are consuming resources at any moment:

```bash
top
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-f40774ea-c196-4d6f-93c0-d7346f0b2528.png)

When you run top, the %CPU column shows how much CPU each process is consuming. You can sort interactively with `Shift + P` for CPU or `Shift + M` for memory, and press k to kill a process by entering its PID. 

If you prefer a one-time snapshot instead of the live interface, you can limit the view to processes owned by a specific user, such as root:

```bash
top -b -n1 -u root
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-ad7b9eff-3779-4cf3-89b1-e73aca75c2dd.png)

Here, the -b flag runs top in batch mode, -n1 captures only one iteration, and `-u` root filters the output to display only processes started by the root user. This is useful for quickly checking whether system-level tasks are causing high CPU load.

### **Using htop**

htop is an improved version of top that offers a more user-friendly interface with color-coded bars and interactive controls. Unlike top, it is not preinstalled and needs to be added manually.

```bash
sudo apt install htop
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-2492a6de-2626-4179-8166-c4e368e8a348.png)

Once installed, launch it with:

```bash
htop
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-428176e4-cb76-47c0-95ca-8afbfee9688f.png)

The top section of htop displays CPU usage across all cores, while the lower section lists processes. Press P to sort by CPU, M to sort by memory, and F6 to customize sorting further. 

You can search for a process with F3, filter by user with u, and terminate a process by selecting it and pressing F9\. Compared to top, htop provides an easier way to interactively manage resource-hungry processes.

### **Using ps**

The ps command provides a static snapshot of processes at the moment you run it. It is especially useful when you need precise reports or when saving command output for documentation:

```bash
ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head -n15
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-7352a4af-6889-4fb0-a2df-5e7b4c64228c.png)

This command shows the top fifteen CPU consumers along with their PID, parent PID, user, command, CPU, and memory usage. The `--sort=-%cpu` option sorts processes in descending order of CPU usage.

You can also filter processes by a specific user. For example, to see processes owned by root:

```bash
ps -u root -o pid,cmd,%cpu --sort=-%cpu
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-5f398c9d-c5ea-4f5a-8380-9f01426a5d27.png)

This makes ps particularly effective when you want to isolate workloads owned by one account, such as an application user.

### **Using pidstat**

pidstat is part of the sysstat package, which provides advanced performance monitoring tools. Since it is not available by default, you need to install it first.

```bash
sudo apt install sysstat
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-2ead7bff-1cdc-4d92-b4b3-4bc61b9ec97f.png)

After installation, run:

```bash
pidstat 1 5
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-15465cd6-2385-49ab-926b-f666ef2d01fd.png)

This shows CPU usage for each process every second, repeated five times. Unlike top or ps, pidstat highlights how processes behave over time, making it easier to spot tasks that repeatedly spike CPU usage.

### **Using sar**

sar, also included in sysstat, can collect and report both real-time and historical system activity. This is valuable when you want to see trends rather than just current values.

```bash
sar -u 5 5
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-623a684e-1e34-4988-bfc2-d47bfca4c29b.png)

The `-u` flag requests CPU utilization statistics, and 5 5 means readings are taken every five seconds for five intervals. The output breaks CPU time into user, system, idle, and I/O wait percentages, helping you determine whether high usage is caused by applications or by system-level overhead.

### **Using iostat**

iostat, another tool in the sysstat package, focuses on CPU and I/O performance. It is especially useful when high CPU usage is linked to disk bottlenecks.

```bash
iostat -c 2 5
```

![](https://blog.alphavps.com/content/images/2025/09/data-src-image-d94c6a3f-8a0d-4418-a119-a41a98bcbf8f.png)

The `-c` flag restricts output to CPU statistics only, and 2 5 specifies updates every two seconds for five iterations. In the output, pay close attention to the %iowait column. If this value is high, it means the CPU is mostly idle but waiting on disk operations, which can mimic high CPU usage.

## **Safely Kill High CPU Processes on VPS**

Once you identify a high-CPU process using the earlier commands (top, htop, or ps), the next step is to terminate it. Every process is assigned a PID (Process ID), which appears in the output of those tools. With the PID in hand, you can safely quit or kill the process using the following methods.

### **Using kill with PID**

The kill command is the most direct way to stop a process. It works by sending a signal to the process ID (PID).

```bash
kill -15 <PID>
```

The `-15` option sends a SIGTERM (terminate) signal. This politely asks the process to exit, giving it a chance to close files and free resources. It is always best to try SIGTERM first because it prevents data corruption.

If the process does not respond to SIGTERM, you can use the stronger SIGKILL signal:

```bash
kill -9 <PID>
```

The `-9` option forces the process to stop immediately. While effective, it does not allow cleanup, which may leave temporary files or incomplete writes. Use SIGKILL only as a last resort.

### **Using pkill by Process Name**

Instead of manually looking up PIDs, you can terminate processes by name with pkill.

```bash
pkill -15 nginx
```

This sends a SIGTERM to all processes matching the name nginx. Replace nginx with the name of the service or application you want to stop. Like kill, you can also use -9 if SIGTERM fails, but always try -15 first.

### **Using killall for Multiple Instances**

Another option is killall, which stops all processes with a given name.

```bash
killall -15 apache2
```

This example sends a SIGTERM to all apache2 processes. If several instances of the same program are running and causing high CPU usage, killall makes it quick to shut them down at once.

### **Safety Notes Before Killing a Process**

Never kill PID 1 — it is the init/systemd process, and stopping it will crash your entire VPS.

Be careful with databases (e.g., mysqld, postgres) — killing them abruptly can lead to data loss or corruption.

If a process is a system service, it is safer to restart it with:

```bash
sudo systemctl restart <service-name>
```

This ensures the service restarts cleanly instead of crashing midway.

Reliable CPU performance starts with strong infrastructure.  
At [AlphaVPS](https://alphavps.com/high-performance-vps.html?ref=blog.alphavps.com), our [High-Performance VPS](https://alphavps.com/high-performance-vps.html?ref=blog.alphavps.com) and [Ryzen VPS](https://alphavps.com/ryzen-vps.html?ref=blog.alphavps.com) plans provide consistent compute power for workloads you monitor with tools like `top`, `htop`, and `pidstat`.  
If you need more storage for logs or backups, our [Storage VPS](https://alphavps.com/storage-vps.html?ref=blog.alphavps.com) offers dependable performance for heavier I/O tasks.

## **Conclusion**

Running a VPS gives you control over its performance, and high-CPU processes are one of the most difficult parts of managing any server. In this guide, we've explored many ways to find resource-heavy tasks using; "top", "htop", "ps", and various sysstat utilities (pidstat, sar, and iostat, to name a few). 

Once you discover the process causing the spike, it's equally important to safely stop it. The kill, pkill, and killall commands provide the muscle, while caution reminds you to avoid stopping system services essential for the process of healthy computing. Your best effort will lead to more proactive monitoring to stabilize, prevent downtime, and keep your VPS running smoothly.