$linuxjunkies
>

mpstat(1)

Report processor-related statistics and monitor CPU performance in real-time.

UbuntuDebianFedoraArch

Synopsis

mpstat [-A] [-n] [-u] [-P {cpu|ALL}] [interval [count]]

Description

mpstat displays per-processor CPU statistics and average CPU statistics for the entire system. It reports user, system, I/O wait, and idle time percentages, helping identify CPU bottlenecks and load distribution across multiple processors.

By default, mpstat shows statistics since the last system boot. When an interval is specified, it reports statistics for that sampling period, with an optional count to repeat the measurement multiple times.

Common options

FlagWhat it does
-ADisplay all CPU statistics (equivalent to -u -I ALL -n)
-uReport CPU utilization (default: %user, %nice, %sys, %iowait, %irq, %soft, %idle)
-I ALLReport interrupts statistics for all interrupt types
-P {cpu|ALL}Show statistics for specific CPU (0, 1, etc.) or ALL processors
-nDisplay average CPU statistics since system startup
-o JSONOutput statistics in JSON format
-TDisplay timestamp for each report

Examples

Display average CPU statistics since system boot for all processors

mpstat

Show CPU statistics every 1 second, 5 times total

mpstat 1 5

Display per-CPU statistics for all processors, updated every 2 seconds

mpstat -P ALL 2

Monitor CPU 0 only with 1-second intervals for 10 iterations

mpstat -P 0 1 10

Show comprehensive CPU, interrupt, and network statistics every second

mpstat -A 1

Display per-CPU stats with timestamps, 3 samples, 1-second interval

mpstat -T -P ALL 1 3

Related commands