> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Find What Is Using High CPU on Linux

> High CPU usage on Linux? Find the process with top (press P) or pidstat -u 5 1, check steal and iowait, then stop, limit or fix the program that is causing it.

To find what is using high CPU on Linux, run `top` and press `P` to sort by `%CPU`, or run `pidstat -u 5 1` for a five-second average per process. The process at the top is your cause. Also check the `%Cpu(s)` line: high `us` means a program, high `sy` the kernel, high `wa` the disk, and high `st` CPU time taken by the hypervisor on a virtual server.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 minutes | Every Linux distribution | SSH access; `sysstat` for `pidstat` and `mpstat` |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). If the server is too slow to log in, use the VPS [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md).
* Commands that act on other users' processes need `sudo`; root can leave it out.
* Install `sysstat` for `pidstat` and `mpstat`:

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo apt install sysstat
> ```

> [tab] AlmaLinux / Rocky
>
> ```bash theme={null}
> sudo dnf install sysstat
> ```

## How to find the process using the most CPU

**1. Open top**

```bash theme={null}
top
```

`top` sorts by `%CPU` by default. If someone changed it, press `P` (capital) to sort by CPU again, `M` for memory. Press `1` to show each core separately and `q` to quit.

**2. Read the summary line**

```text theme={null}
%Cpu(s): 92.1 us,  3.0 sy,  0.0 ni,  4.5 id,  0.0 wa,  0.0 hi,  0.2 si,  0.2 st
```

The table below tells you what each part means.

**3. Note the PID and command**

The first row shows the busiest process. Press `c` to see its full command line, which tells you, for example, which PHP script or Java server it is.

| Field | Time spent | High value usually means |
| - | - | - |
| `us` | Running programs | A busy application: web app, game server, database query |
| `sy` | Running kernel code | Heavy networking, many small file operations, or a driver problem |
| `ni` | Running low-priority (niced) programs | Background jobs you started with `nice` |
| `wa` | Idle, waiting for I/O | A disk bottleneck. See [check disk I/O](https://help.freakhosting.com/portals/other/how-to-check-disk-io-performance-on-linux.md) |
| `si` / `hi` | Handling interrupts | Very high network packet rates |
| `st` | Stolen by the hypervisor | On a VPS: your vCPU was ready but the host ran something else |

## How to get an average instead of a snapshot

`top` refreshes every few seconds, so a short spike can mislead you. `pidstat` averages over an interval:

```bash theme={null}
pidstat -u 5 1
```

```text theme={null}
Average:      UID       PID    %usr %system  %guest   %wait    %CPU   CPU  Command
Average:       33      1185   81.20    4.60    0.00    0.20   85.80     -  php-fpm8.3
Average:      999      2038   10.40    1.00    0.00    0.00   11.40     -  mariadbd
```

`%CPU` is per core, so on a 4-core server a process can reach 400%. `%wait` is time the process was ready to run but waiting for a CPU.

To see each core:

```bash theme={null}
mpstat -P ALL 5 1
```

One core at 100% while the others idle means a single-threaded program has hit its limit; more cores won't help that program.

## Why ps shows a different CPU number

```bash theme={null}
ps -eo pid,user,%cpu,%mem,etime,comm --sort=-%cpu | head
```

This is useful for a quick list, but `ps` calculates `%CPU` as total CPU time divided by how long the process has existed. A process that has been busy for the last minute but idle for a week shows a low value. Use `top` or `pidstat` for what is happening now.

## How to find CPU usage per service

On servers with systemd, see which service (with all its child processes) uses the most CPU:

```bash theme={null}
sudo systemd-cgtop -1 --order=cpu
```

This catches services that start many short-lived processes, such as PHP-FPM pools or cron-launched scripts.

## Common causes and fixes

| You see | Likely cause | What to do |
| - | - | - |
| `php-fpm`, `apache2`/`httpd`, `node` | Heavy traffic, bots or a slow page | Check access logs; add caching; block abusive IPs |
| `mysqld` / `mariadbd` | Slow or unindexed queries | Enable the slow query log and add indexes |
| `java` (Minecraft and others) | Too many players, plugins or entities | Use the game's profiler; reduce view distance |
| `kswapd0` | Memory pressure | See [check memory usage](https://help.freakhosting.com/portals/other/how-to-check-memory-usage-on-linux.md) |
| Unknown name, random path, or a process in `/tmp` | Possible malware or crypto miner | See [what to do if your server is hacked](https://help.freakhosting.com/portals/other/what-to-do-if-your-linux-server-is-hacked.md) |
| High `st` with nothing busy inside | Host contention on a virtual server | Note the times and [open a ticket](https://freakhosting.com/clientarea/submitticket.php) |

To stop or slow a process:

* Stop a service cleanly: `sudo systemctl stop name`, or restart it with `restart`.
* Lower its priority: `sudo renice -n 10 -p 1185`.
* Cap it permanently: see [limit CPU and memory for a process](https://help.freakhosting.com/portals/other/how-to-limit-cpu-and-memory-for-a-process.md).
* End a stray process: see [kill a process](https://help.freakhosting.com/portals/other/how-to-kill-a-process-on-linux.md).

> [!WARNING]
>
> Don't kill a process you don't recognise on a production server until you know what it is. Run `ls -l /proc/1185/exe` and `systemctl status 1185` to see which file and service it belongs to.

## How to check it worked

Run `pidstat -u 5 1` again. The process should be gone or much lower, and the `id` (idle) value in `top` should rise. The load average falls over the next few minutes (see [what is load average](https://help.freakhosting.com/portals/other/what-is-load-average-on-linux.md)).

## Frequently asked questions

### Why does top show more than 100% CPU for one process?

`%CPU` is per core. A program using 3 cores fully shows 300%. Press `Shift+I` in `top` to switch to Solaris mode, which divides by the number of cores.

### What is a normal CPU steal time?

Close to `0`. Occasional small values are normal on any virtual server. If `st` stays high while your own processes are quiet, note the times and contact support.

### How can I see which process used CPU in the past?

`top` only shows now. Install a monitoring tool such as [Netdata](https://help.freakhosting.com/portals/other/how-to-set-up-netdata-monitoring.md) or [Prometheus and Grafana](https://help.freakhosting.com/portals/other/how-to-monitor-a-server-with-prometheus-and-grafana.md) to keep history. The [VPS Panel graphs](https://help.freakhosting.com/portals/vps-panel/how-to-monitor-vps-resource-usage.md) show total CPU over time.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every server guide in one place.

> [card] [Monitor resources with htop](https://help.freakhosting.com/portals/other/how-to-monitor-server-resources-with-htop.md)
>
> Interactive process viewer.

> [card] [Fix high load](https://help.freakhosting.com/portals/other/how-to-fix-high-load-on-a-linux-server.md)
>
> Step-by-step troubleshooting.

> [card] [Limit CPU and memory](https://help.freakhosting.com/portals/other/how-to-limit-cpu-and-memory-for-a-process.md)
>
> CPUQuota, nice and cgroups.

> [card] [Kill a process](https://help.freakhosting.com/portals/other/how-to-kill-a-process-on-linux.md)
>
> Stop a runaway program.

***

> [!NOTE]
>
> **Checked against the [top(1)](https://man7.org/linux/man-pages/man1/top.1.html), [ps(1)](https://man7.org/linux/man-pages/man1/ps.1.html), [pidstat(1)](https://sysstat.github.io/) and [systemd-cgtop(1)](https://www.freedesktop.org/software/systemd/man/latest/systemd-cgtop.html) manuals** on 4 November 2026; `top`, `ps`, `pidstat` and `mpstat` tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.