
When a server feels slow, the first question is whether the CPU is busy and which process is using it. Ubuntu has several built-in and easy-to-install tools that answer that in seconds. This guide shows how to check CPU usage with top, htop, mpstat, vmstat, sar and ps, how to read the numbers, and what high CPU usage on a VPS usually means. The commands work on Ubuntu 18.04, 20.04, 22.04, 24.04 and 26.04, and on most other Linux distributions.
Quick answerRun top and look at the %Cpu(s) line: 100 - id is your total CPU usage. Press Shift + P to sort processes by CPU, and 1 to show each core.
How many CPU cores do you have?
CPU percentages only make sense once you know the core count:
nproc
lscpu
nproc prints the number of usable cores. lscpu shows the model, sockets, cores and threads. On a 4-core VPS, a single process can show up to 400% in per-process views.
Method 1: top
top is installed on every Ubuntu system:
top
The third line looks like this:
%Cpu(s): 12.5 us, 3.1 sy, 0.0 ni, 83.9 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
- us: user processes (your applications).
- sy: the kernel.
- id: idle. Total usage is roughly 100 minus this value.
- wa: waiting for disk or network I/O. A high value points to slow storage rather than CPU.
- st: steal time. On a VPS, this is time the hypervisor gave to other guests. Consistently high steal means the host is overloaded.
Useful keys: P sorts by CPU, M by memory, 1 toggles per-core view, k kills a process, q quits. For a one-off snapshot in a script, use top -bn1 | head -15.
Method 2: htop
htop is a friendlier, colour version of top with per-core bars:
sudo apt install htop
htop
Each bar at the top is one core. Click a column header (or press F6) to sort, F4 to filter by name, F5 for a tree view that shows which parent started a process, and F9 to send a signal.
Method 3: mpstat (per-core statistics)
mpstat comes in the sysstat package:
sudo apt install sysstat
mpstat -P ALL 2 5
This prints usage for every core every 2 seconds, 5 times, followed by an average. It quickly shows whether one core is pinned at 100% (a single-threaded workload) while the others are idle.
Method 4: vmstat
vmstat 2 5
vmstat is preinstalled. Under the cpu heading, read us, sy, id, wa and st as in top. The r column shows how many processes are waiting to run; if it stays above your core count, the CPU is a bottleneck.
Method 5: sar (history)
The tools above show the present. sar, also from sysstat, records CPU usage every 10 minutes so you can look back:
sudo systemctl enable --now sysstat
sar -u # today
sar -u 1 5 # live, every second
sar -u -f /var/log/sysstat/sa15 # the 15th of this month
On older Ubuntu releases you may also need to set ENABLED="true" in /etc/default/sysstat. History starts from the moment collection is enabled.
Method 6: ps (top processes in one command)
ps -eo pid,user,%cpu,%mem,cmd --sort=-%cpu | head -10
This lists the ten processes using the most CPU, which is ideal for scripts and alerts. Note that ps shows average usage over each process's lifetime, so for current usage prefer top or htop.
Load average
uptime
cat /proc/loadavg
The three numbers are the 1, 5 and 15-minute load averages. Compare them with the core count from nproc: a load of 4.0 on a 4-core server means it is fully busy; well above that means tasks are queuing. Load also counts processes waiting on disk, so check wa as well.
What to do about high CPU usage
- Identify the process with htop or ps, then check its logs.
- Unknown processes with random names using 100% CPU can be cryptominers on a compromised server; check
crontab -l, change passwords and review SSH access. - High
wameans slow disk, not CPU. Highstmeans the host is overloaded; contact your provider. - If the load is genuine and constant, upgrade to more cores.
Frequently asked questions
How do I check CPU usage in Ubuntu from the terminal?
Run top or htop. Total usage is 100 minus the idle (id) value, and the process list shows which program is using it.
Why does a process show more than 100% CPU?
Per-process figures count each core as 100%. A program using two full cores shows 200%. Press Shift + I in top to switch to Irix-off mode, which divides by the core count.
How do I check CPU usage history?
Install sysstat, enable its service, and use sar -u. It keeps daily files in /var/log/sysstat/.
What is steal time on a VPS?
The share of time your virtual CPU wanted to run but the physical host was serving other VMs. A few percent is normal; a steady 10% or more slows your server down.


