🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

vmstat Command

Intermediate Performance & Debugging man(1)

Report virtual memory statistics

👁 9 views 📅 Updated: Mar 15, 2026
SYNTAX
vmstat [OPTION]... [DELAY [COUNT]]

What Does vmstat Do?

vmstat (virtual memory statistics) reports system performance statistics including processes, memory, swap, I/O, and CPU activity. It provides a quick overview of system health in a compact format.

vmstat is excellent for real-time monitoring — run it with an interval to see how system resources change over time. It shows whether a system is CPU-bound, memory-bound, or I/O-bound.

vmstat is lighter than top and provides different insights. It is commonly used for quick system health checks and performance monitoring in scripts.

Options & Flags

OptionDescriptionExample
N Update every N seconds vmstat 5
N M Update N seconds, M times vmstat 2 10
-w Wide output vmstat -w 1
-s Display memory statistics vmstat -s
-d Disk statistics vmstat -d
-t Add timestamp vmstat -t 1

Practical Examples

#1 Quick snapshot

Shows a single snapshot of system statistics.
$ vmstat
Output: procs ---memory--- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 0 2048000 128000 4096000 0 0 5 10 200 400 10 2 87 1

#2 Continuous monitoring

Shows stats every 2 seconds, 10 times.
$ vmstat 2 10

#3 Wide output

Wider columns for better readability, updating every second.
$ vmstat -w 1

#4 Memory summary

Shows detailed memory statistics.
$ vmstat -s

#5 With timestamps

Shows stats every 5 seconds with timestamp.
$ vmstat -t 5

Tips & Best Practices

Key columns to watch: r (runnable processes): >CPU count means overloaded. si/so (swap in/out): >0 means swapping. wa (I/O wait): >10% means I/O bottleneck.
First line is averages: The first line of vmstat output shows averages since boot. Subsequent lines show current values.
Swap activity is bad: si/so values > 0 mean the system is actively swapping. This indicates insufficient RAM and severe performance impact.

Frequently Asked Questions

How do I check if the system is overloaded?
vmstat 1 — watch the r column (>CPU count = overloaded), wa column (>10% = I/O wait), and si/so (>0 = swapping).
What do the columns mean?
r=runnable procs, b=blocked, swpd=swap used, free=free RAM, si/so=swap in/out, us=user CPU, sy=system CPU, id=idle, wa=I/O wait.
How is vmstat different from top?
vmstat shows a compact one-line summary per interval. top shows per-process detail. vmstat is better for quick system-level monitoring.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →