The Linux command to check CPU usage is one of the first things every sysadmin, developer, and DevOps engineer learns — and one of the most useful skills you can carry into any troubleshooting session. On top of that, whether a server has suddenly become unresponsive, a build is taking far longer than expected, or you simply want to know why your laptop fan sounds like a jet engine, tools like top, htop, mpstat, vmstat, and sar will tell you exactly what is happening inside your machine. This guide walks through each of them, explains how to read the numbers correctly, and shows you how to move from "CPU is at 100%" to knowing precisely which process is responsible.
Why Monitoring CPU Usage Matters
CPU usage is a measure of how much computational work your processor is doing relative to its capacity. When it stays pinned near 100% for long periods, everything else slows down: web requests time out, database queries queue up, and interactive sessions feel sluggish.
The official docs gloss over this. That's a mistake.
But raw percentage alone rarely tells the full story. But a system can show high CPU usage while performing almost no useful work — for example, when it is thrashing on disk I/O or spinning in a retry loop. That is why experienced engineers look at where the CPU time is going, not just how much of it is used.
Monitoring CPU usage helps you:
- Identify runaway or misbehaving processes before they cause an outage
- Detect capacity problems early and plan upgrades with real data
- Distinguish CPU bottlenecks from memory, disk, or network bottlenecks
- Verify that performance tuning actually improved things
- Catch security issues such as cryptomining malware, which typically shows up as sustained unexplained CPU load
Understanding Load Average Before You Panic
The uptime command gives you an instant snapshot:
uptime
You will see three numbers, representing the load average over 1, 5, and 15 minutes. Load average counts processes that are either running or waiting for a resource — CPU, disk, or network.
The critical rule: compare load average against your core count, not against 1.0. On a 4-core machine, a load average of 4.Plus, 0 means the system is fully but healthily utilized. The same number on a single-core machine means severe saturation.
Check your core count with:
nproc
A useful rule of thumb is that load average consistently above 70% of your total core count deserves investigation, and sustained load above your core count means a genuine backlog is forming.
Quick Reference: The Most Common Commands
| Command | Best for | Installation |
|---|---|---|
top |
Instant overview, always available | Pre-installed |
htop |
Colorful, interactive monitoring | apt install htop / dnf install htop |
mpstat |
Per-core statistics | sysstat package |
vmstat |
CPU + memory + I/O combined | Pre-installed (procps/sysstat) |
sar |
Historical CPU data | sysstat package |
ps |
Finding the offending process | Pre-installed |
| `pidstat |
| pidstat | Per-process CPU over time | sysstat package |
Reading the Numbers Correctly
CPU percentage by itself can be misleading. Most monitoring tools break CPU time into several categories, and knowing which one is high changes the diagnosis entirely:
- user (
us): Time spent running application code in user space. High user CPU usually means your application is genuinely busy—calculating, rendering, or processing data. - system (
sy): Time spent in the kernel on behalf of processes (system calls, memory management, scheduling). Sustained high system CPU often points to excessive context switching, locking contention, or inefficient I/O patterns. - nice (
ni): Time spent running low-priority user processes. This is still user work, just deprioritized. - idle (
id): The CPU is doing nothing. On a multi-core system, some idle time is normal and healthy. - iowait (
wa): The CPU is idle because it is waiting for disk or network I/O to complete. This looks like CPU idle in some tools, but it is actually a storage or network bottleneck, not a processor shortage. - steal (
st): In virtualized environments, time the hypervisor forced your virtual CPU to wait while another tenant used the physical hardware. High steal means a “noisy neighbor” or an undersized instance. - irq / softirq: Time servicing hardware or software interrupts. Spikes here can indicate driver issues or a flood of network packets.
A useful rule: if id + wa is high, you do not have a CPU problem. Which means if wa is high, look at disk and network. On top of that, if st is high, consider moving to a larger or dedicated host. If us or sy is high, you have a real CPU demand that needs investigation Turns out it matters..
Most guides skip this. Don't.
From “CPU Is at 100%” to the Exact Process
When a system feels sluggish and CPU usage is near the ceiling, follow this workflow to pinpoint the responsible process.
1. Confirm and rank
Open top or htop. Press P (in `top