vmstat

Linux · Processes · reference only

What it does

Shows system statistics: processes, memory, swap, input/output, interrupts and CPU usage.

Syntax

vmstat [opciones] [retardo [repeticiones]]

Options and parameters

  • retardo repeticiones

    Seconds between samples and number of samples to take.

  • -a

    Shows active and inactive memory instead of buffers and cache.

  • -s

    Shows a summary of event counters and memory.

  • -d

    Shows disk statistics.

  • -S unidad

    Changes the memory unit: k, K, m or M.

  • -t

    Adds the time to each line.

  • -w

    Uses a wider format for systems with a lot of memory.

Usage examples

  • vmstat

    Shows a snapshot with averages since boot.

  • vmstat 1 3

    Takes three samples one second apart.

  • vmstat -s

    Shows the system's memory and event counters.

  • vmstat -S M 2 5

    Five samples every 2 seconds with memory in megabytes.

Notes and common mistakes

  • The first line shows the average since boot; the following ones reflect the interval.
  • Sustained non-zero values in the si and so columns mean the system is using swap.

Related commands