vmstat
Processes and system
Usage
vmstat <interval> [count]Prints memory, swap, disk and CPU counters at a fixed interval; throw away the first line, which is an average since boot rather than now, and look at the si/so and wa columns first.
Common flags
| Flag | Meaning |
|---|---|
| vmstat 1 5 | Five samples, one second apart. |
| -s | A one-off table of memory counters since boot. |
| -w | Wide columns, so the numbers stop colliding. |
| -d | Per-disk statistics instead of the summary. |
| si / so | Swap in and out. Anything sustained here means real memory pressure. |
| wa | Percentage of time the CPU sat waiting for disk. |
Examples
vmstat 1 5Five one-second samples; ignore the first line.
vmstat -w 2Keep sampling every two seconds with readable columns.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does vmstat do?
Prints memory, swap, disk and CPU counters at a fixed interval; throw away the first line, which is an average since boot rather than now, and look at the si/so and wa columns first.
Q. How do I type it?
vmstat <interval> [count] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
6 are listed here; the full set is in man vmstat. This command sits under Processes and system.
Related commands
man page: man vmstat