Linux

How to Check CPU Usage on Linux: Overall, Per Core, and Per Process

Read overall Linux CPU usage with top, measure each logical CPU with mpstat, and use pidstat to see how much CPU a process used in the last second.

Updated 2026-11-235 min read

Run top for a live view of Linux CPU usage. The %Cpu(s) line summarizes the machine, and the %CPU column in the process list measures individual processes. For a reading you can copy into a ticket, use mpstat -P ALL 1 3 for the machine and each logical CPU, or pidstat -u 1 3 for processes. Both commands take three one-second samples and are included in the sysstat package.

Read overall CPU usage with top

Start top and wait for the next refresh. Press 1 to toggle between one summary and a row per logical CPU. Press uppercase P to sort processes by CPU usage, and q to quit. For a terminal log, run:

LC_ALL=C top -b -d 1 -n 2

Read the second report to see the one-second interval between refreshes. Here’s its summary from a Linux machine with 24 logical CPUs:

%Cpu(s):  1.3 us,  0.5 sy,  0.2 ni, 97.8 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st

The machine spent 97.8% of that interval idle (id), leaving about 2.2% non-idle. Most of the measured work was user code (us) and kernel code (sy). Percentages are rounded. Keep two other fields in view when reading a busier machine:

  • wa is I/O wait, time accounted as idle with outstanding I/O. A large wa value can raise 100 − id even when applications spend little time executing.
  • st is steal time on a virtual machine. It measures time the hypervisor spent running something else while the guest was ready to run.

Measure each logical CPU with mpstat

LC_ALL=C mpstat -P ALL 1 3

Read the final Average: rows for the three-second window. These are selected rows and columns from a separate sample on the same machine:

CPU   %usr   %sys   %iowait   %soft   %steal   %idle
all   8.53   1.96      0.00    0.44     0.00   89.07
  0   4.29   1.32      0.00    5.94     0.00   88.45
  1   4.29   0.99      0.00    1.65     0.00   93.07

all is the average across all 24 logical CPUs, including the 22 rows omitted here. Overall non-idle time was 10.93%. CPU 0 spent 5.94% of its own time handling software interrupts (%soft). If one row is close to zero idle while all has ample idle time, a workload may be filling one logical CPU. A single busy thread can also move between CPUs during the sample. mpstat manual

Measure CPU usage for one process with pidstat

Run pidstat -u 1 3 to sample active processes. If you already know the process ID, use -p to follow it. Replace 1234 with the PID you want to measure.

pidstat -u -p 1234 1 3

We sampled a single-threaded Python loop on the same host. Below are three columns from the output. The CPU column shows the logical CPU on which the task last ran. The %CPU column shows how much processor time it received over that interval.

 %CPU   CPU   Command
99.00    19   python3
100.00    2   python3
100.00    3   python3

The loop used almost one full logical CPU, averaging 99.67% by pidstat’s default scale, even though the scheduler moved it. On a 24-CPU host that’s about 4.15% of total capacity. With this scale, a process running work on two CPUs simultaneously can reach 200%. To divide process usage by the machine’s CPU count automatically, add -I to the same pidstat command. pidstat manual

Diagnose it with Rumus

Rumus AI-native terminal workspace showing a command-line session
AI-native terminal Commands require your approval
Why use Rumus for this diagnosis?

Rumus is an AI-native terminal that can investigate the actual Linux host. Its agent reads relevant files, services, logs, processes, and system state, then proposes a reviewable plan before making changes.

What Rumus can inspect

  • Services, processes, sockets, and system resources
  • Logs, configuration files, permissions, and ownership
  • Read-only evidence before cleanup or restarts
Download Rumus

Open the Linux host in Rumus. If a process shows nearly 100% CPU while the machine looks mostly idle, ask Rumus to measure both over the same interval:

Take three one-second CPU samples on this host using read-only commands.
Show the overall usage, the busiest logical CPU, and the busiest process by PID
and name. Report I/O wait and steal time separately. For the busiest process,
explain what its CPU percentage means as a share of the whole machine.
If sysstat is unavailable, use top.

Questions about Linux CPU readings

Why do ps and top give different numbers?

ps -eo pid,comm,pcpu --sort=-pcpu | head

On Linux, ps reports a process’s accumulated CPU time divided by its elapsed lifetime. A service that slept for hours and became busy a second ago can appear low in ps and high in top or pidstat. When comparing two readings, use the same interval and check whether 100% means one logical CPU or the entire machine. ps manual

Can I see per-core usage without installing sysstat?

Yes. Open top and press 1 to show a line for each logical CPU if you see only the summary. On a machine with simultaneous multithreading, two lines may belong to the same physical core. Run lscpu -e=CPU,CORE,SOCKET to see which logical CPUs share a core and socket.

Does low host CPU usage mean my container has spare CPU?

A container can exhaust its CPU allowance while the host has plenty of idle time. With cgroup v2, a cpu.max setting of 50000 100000 allows the group 50 ms of CPU time per 100 ms period, equivalent to half a logical CPU on average. Check the container’s limits and whether nr_throttled in its cpu.stat rises across the same interval. Linux cgroup v2 CPU controller

If usage stays high and you need to trace it to a thread or service, follow How to Diagnose High CPU Usage on Linux. If load average is high while most CPUs remain idle, see How to Diagnose High Load Average on Linux.

Diagnose the real environment

Open the server in Rumus and let the AI agent inspect context, propose a plan, and ask before it runs changes.

Download Rumus