vmstat command in Linux: memory, swap and CPU
Updated July 3, 2026
The vmstat command summarizes processes, memory, swap, disk and CPU on one line.
Syntax
vmstat [interval] [count]Common cases
vmstat # a single snapshot
vmstat 2 # refresh every 2 seconds
vmstat 2 5 # five snapshots, 2 seconds apart
vmstat -s # memory and event counters since bootHow it works: which columns to read
The first
vmstatline is an average since boot, so you read from the second. The key columns:ris how many processes are queued for the CPU (more than the core count means a CPU bottleneck),siandsoare swap-in and swap-out (any steady non-zero value means you are running low on memory),wais the share of time the CPU waits on disk.vmstatis a good quick first look: it shows at once where the bottleneck is.
Used in
You need this in the lesson Monitoring. The theory is the chapter Monitoring and bottlenecks.
See also
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.