vmstat Command Generator
Generate vmstat commands to report virtual memory statistics
Getting Started with vmstat
## What is vmstat?
The `vmstat` command reports virtual memory, process, CPU, and I/O statistics. A single invocation gives a snapshot since boot; supplying a delay runs it in a continuous monitoring loop — invaluable for diagnosing memory pressure, swap usage, and CPU saturation.
## How to Use
1. **Set Delay**: Enter an interval in seconds to run continuously (e.g. `2`). Omit for one snapshot. 2. **Set Count**: Limit the number of samples (e.g. `5`). 3. **Pick Options**: Use `-a` for active/inactive memory, `-s` for event counters, `-d` for disk stats, or `-w` /`-t` for wide/timestamped output. 4. **Copy & Run**: Copy the generated command into your terminal.
Common Options
### `delay` and `count` (positional) Pass an interval in seconds and an optional sample count. `vmstat 2 5` reports five samples two seconds apart and then exits. Without a count, vmstat runs indefinitely.
### `-a` Active/inactive memory Show the `active` and `inact` (inactive) memory columns instead of the default `buff`/`cache` split. Helpful for spotting how much RAM is genuinely in use.
### `-s` Statistics Display a table of event counters and memory totals since boot (forks, context switches, swap in/out, free/shared/buffer/cache memory). Output is a one-off, not a loop.
### `-d` Disk statistics Report per-disk reads, writes, and IO totals. Useful when investigating which device is busy.
### `-w` Wide output Widen the columns so values never wrap — easier to read on high-resolution terminals or when piping to a log.
### `-t` Timestamp Add a timestamp column to every sample, which is essential when archiving output for later analysis.
### `-S` Unit Set the display unit for memory with one of `k`, `K`, `m`, `M`. Example: `vmstat -S M 2` shows memory in megabytes.
▶Which column tells me the system is low on memory?
▶How do I log vmstat to a file with timestamps?
▶What do the CPU us/sy/id/wa columns mean?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee