Command to find CPU utilization in Linux is a fundamental skill for system administrators, developers, and anyone who needs to monitor the health of a Linux machine. Knowing how to query CPU usage lets you spot performance bottlenecks, plan capacity upgrades, and troubleshoot sluggish applications. This guide walks through the most common command‑line tools, explains what each metric means, and shows practical examples you can run immediately on any modern distribution Small thing, real impact. But it adds up..
Introduction
Linux exposes a wealth of information through the /proc filesystem and various utilities that read those counters. Also, whether you prefer a quick glance with top, a detailed statistical report from sar, or a colorful interactive dashboard like htop, there is a command to fit every workflow. The sections below break down each tool, its typical output, and when you might choose one over the others Turns out it matters..
The official docs gloss over this. That's a mistake.
Understanding CPU Utilization Metrics
Before diving into the commands, it helps to clarify what “CPU utilization” actually measures.
| Metric | Description | Typical Unit |
|---|---|---|
| %user | Time spent executing user‑space processes (non‑kernel code). Still, | Percent |
| %steal | In virtualized environments, the percentage of CPU stolen by the hypervisor from other VMs. Because of that, | Percent |
| %guest | Time spent running a virtual CPU for guest operating systems (under KVM/Xen). Consider this: | Percent |
| %idle | Time the CPU is idle, not executing any task. In practice, | Percent |
| %nice | CPU time given to processes with a manually adjusted niceness value. | Percent |
| %iowait | Time the CPU spends waiting for I/O operations to complete. | Percent |
| %system | Time spent in kernel space handling system calls and interrupts. | Percent |
| %guest_nice | Same as %guest but for niched guest processes. |
Most tools aggregate these percentages across all logical CPUs (cores × threads). A single core at 100 % utilization means it is fully busy; on an 8‑core system, 800 % total CPU usage would indicate all cores are saturated That's the whole idea..
Common Commands to Find CPU Utilization
Below are the most frequently used utilities. Each entry includes a brief description, typical invocation, and a sample output snippet Worth keeping that in mind. Nothing fancy..
1. top – Real‑time Process Viewer
top is pre‑installed on virtually every Linux system. It updates the display every few seconds and shows a summary line with overall CPU usage.
top
Key fields in the summary line
%Cpu(s): 12.3 us, 2.1 sy, 0.0 ni, 84.5 id, 0.5 wa, 0.0 hi, 0.5 si, 0.0 st
us= %user,sy= %system,ni= %nice,id= %idle,wa= %iowait,hi/%si= hardware/software interrupts,st= %steal.
Press 1 while top is running to see per‑core utilization The details matter here. That alone is useful..
2. htop – Enhanced Interactive Monitor
htop improves on top with color, scrolling, and mouse support (if your terminal allows it). Install it via your package manager (apt install htop, yum install htop, etc.).
htop
The top bar displays CPU usage as graphical meters for each core, making it easy to spot imbalances.
3. mpstat – Processor‑Specific Statistics
Part of the sysstat package, mpstat reports CPU utilization per processor or as an aggregate.
mpstat -P ALL 1 3
-P ALLtellsmpstatto show each CPU.1is the interval in seconds.3is the number of reports.
Sample output:
Linux 5.15.0-78-generic (myhost) 11/02/2025 _x86_64_ (4 CPU)
11:00:00 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
11:00:01 AM all 10.Also, 2 0. So 0 2. That said, 1 0. Consider this: 5 0. Worth adding: 0 0. Think about it: 1 0. Also, 0 0. That said, 0 0. 0 87.Still, 1
11:00:01 AM 0 9. But 8 0. 0 2.0 0.6 0.On the flip side, 0 0. Now, 0 0. 0 0.On top of that, 0 0. 0 87.6
...
### 4. `vmstat` – Virtual Memory Statistics
`vmstat` gives a concise view of CPU, memory, swap, and I/O. The CPU columns appear at the end.
```bash
vmstat 1 5
Output snippet:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 123456 54321 50000 0 0 5 10 120 200 15 3 80 2 0
Columns us, sy, id, wa, st correspond to the same percentages described earlier.
5. sar – System Activity Reporter
Also from sysstat, sar can report historical data (if the service is enabled) or live statistics.
sar -u 1 3
-u selects CPU utilization. Output:
Linux 5.15.0-78-generic (myhost) 11/02/2025 _x86_64_ (4 CPU)
11:00:00 AM CPU %user %nice %system %iowait %steal %idle
11:00:01 AM all 11.Here's the thing — 2 0. 0 2.3 0.4 0.0 86.1
11:00:02 AM all 10.Day to day, 8 0. Plus, 0 2. Here's the thing — 1 0. 5 0.0 86.6
...
To get per‑core data, add `-P ALL`.
### 6. `pidstat` – Per‑Process CPU Utilization
When you need to know which processes are consuming CPU, `pidstat` breaks it down by PID.
```bash
pidstat 1
### 6. `pidstat` – Per‑Process CPU Utilization
When you need to know which processes are consuming CPU, `pidstat` breaks it down by PID. It’s also part of `sysstat`.
```bash
pidstat 1 3
This shows CPU usage per process every second for three reports. Add -p PID to monitor a specific process, or -u (default) for CPU utilization.
Sample output:
Linux 5.15.0-78-generic (myhost) 11/02/2025 _x86_64_ (4 CPU)
11:00:00 AM PID %usr %system %CPU %nice %guest %wait %idle
11:00:01 AM 1234 2.In real terms, 5 0. Plus, 3 2. 8 0.0 0.Even so, 0 0. 0 97.2
11:00:01 AM 5678 0.Worth adding: 0 0. 0 0.Here's the thing — 0 0. That's why 0 0. Still, 0 0. 0 100.0
...
The `%wait` column indicates time spent waiting for I/O, which can help identify processes that are blocked on disk or network operations.
### 7. `nmon` – A Versatile Monitoring Tool
`nmon` (Nigel’s Monitor) is a free, comprehensive tool that captures CPU, memory, disk, network, and other system metrics in a single display. It’s especially useful for long‑term monitoring.
```bash
nmon
Press c for CPU, m for memory, d for disk, n for network, and q to quit. You can also generate reports with nmon -f to save data to a file for later analysis.
8. perf – Linux Profiling and Performance Counters
For deep performance analysis, perf is the go‑to tool. It can measure CPU cycles, cache misses, branch predictions, and more.
perf top
This runs a live profiler, showing functions consuming the most CPU cycles. For a one‑time measurement:
perf stat -a sleep 5
This aggregates system‑wide performance counters during a 5‑second interval Less friction, more output..
9. dstat – A Resource Statistics Tool
dstat combines the functionality of vmstat, iostat, and ifstat into a single, customizable tool. It’s great for real‑time monitoring of CPU, memory, disk, and network.
dstat -cdlmnpsy 1
This displays CPU, disk, load, memory, network, process, system, and swap statistics every second.
Conclusion
Monitoring CPU utilization is essential for diagnosing performance issues, optimizing resource allocation, and ensuring system stability. Each tool offers a unique perspective:
topandhtopprovide high‑level, interactive views.mpstat,vmstat, andsargive detailed per‑core or aggregate statistics.pidstatandperfdrill down into process‑level or hardware‑level metrics.nmonanddstatoffer comprehensive, real‑time monitoring across multiple subsystems.
By mastering these tools, you can quickly identify bottlenecks, understand system behavior, and make informed decisions to improve performance. Start with the tool that best fits your immediate need, and don’t hesitate to combine them for a complete picture of your system’s health.