vmstat: system statistics about memory, processes, disks, block IO, CPU, and more

vmstat reports information about memory, paging, processes, disks, block IO, CPU activity, and traps.

Typical usage: diagnosing problems, system performance monitoring, troubleshooting

Installation

When vmstat is not installed by default, it can be added to the system using the relevant software package.

Package information for vmstat

Operating systemPackage nameInstallation
AlmaLinuxprocps-ng
dnf install procps-ng
Arch Linuxprocps-ng
pacman -S procps-ng
Debianprocps
apt install procps
Fedoraprocps-ng
dnf install procps-ng
openSUSEprocps
zypper install procps
Red Hat Enterprise Linuxprocps-ng
dnf install procps-ng
Rocky Linuxprocps-ng
dnf install procps-ng
Ubuntuprocps
apt install procps

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Long optionShort optionDescription
--active-aActive and inactive memory
--forks-fNumber of forks since boot
--slabs-mSlab information
--one-header-nHeader displayed once
--stats-sEvent counters and memory statistics
--disk-dDisk statistics
--disk-sum-DDisk activity summary
--partition device-pStatistics about partition
--unit character-SChange output unit (k=1000, K=1024, m=1000000, M=1048576)
--timestamp-tInclude timestamp with each line
--wide-wWide output, useful when output does not fit
--version-vVersion information
--help-hDisplay help

Missing an option in this overview? Share your feedback.

Columns in vmstat output

The vmstat command shows many details in several columns and also uses a lot of abbreviations. This overview helps to look up what each field does.

ColumnSectionDescription
activememoryAmount of active memory when using --active
bprocsNumber of process that are in blocked state as they are waiting for IO to complete (e.g. network / disk)
biioAmount received from a block device (KiB/s)
boioAmount sent to a block device (KiB/s)
buffmemoryAmount of memory used as buffers
cachememoryAmount of memory used as cache
cssystemNumber of context switches per second
freememoryAmount of idle memory
gucpuTime spent running KVM guest code (guest time, including guest nice)
idcpuTime spent idle
insystemNumber of interrupts per second, including the clock
inactmemoryAmount of inactive memory when using --active
rprocsNumber of runnable processes that are running or waiting for in runqueue
siswapAmount of memory swapped in from the disk (per second)
soswapAmount of memory swapped to the disk (per second)
swpdmemoryAmount of swap memory used
uscpuTime spent running non-kernel code (user time, including nice time)
stcpuTime stolen from a virtual machine
sycpuTime spent running kernel code (system time)
wacpuTime spent waiting for IO

Examples using vmstat

Basic usage

Run vmstat and show default output

vmstat

Example output:

# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 1512912  55276 332288    0    0     1     1   11   17  0  0 100  0  0

Run vmstat with 2 second delay, repeat 5 times, then stop

vmstat 2 5

Disk IO

Show disk IO from all available block devices

vmstat --disk

Example output:

# vmstat --disk
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
loop0     15      0      42       0      0      0       0       0      0      0
loop1     97      0    4312      11      0      0       0       0      0      0
loop2    137      0    4536      23      0      0       0       0      0      0
loop3     86      0    1396      10      0      0       0       0      0      0
loop4     82      0    1392       7      0      0       0       0      0      0
loop5    792      0   22880      44      0      0       0       0      0      0
loop6    113      0    3052      24      0      0       0       0      0      0
loop7   4717      0  419512     239      0      0       0       0      0     62
nvme0n1 1537360 411987 168028478  437136 96280014 83428385 4183423494 385002672      0 102226
nvme1n1 1043258   1389 134580170  330184 5458709  98614 687186776 10619429      0   3203

Statistics

Show all statistics

vmstat --stats

Example output:

# vmstat --stats
      4009172 K total memory
       970616 K used memory
      1456496 K active memory
       564108 K inactive memory
      1715940 K free memory
       100252 K buffer memory
      1520340 K swap cache
      3353020 K total swap
            0 K used swap
      3353020 K free swap
        14200 non-nice user cpu ticks
          346 nice user cpu ticks
         5848 system cpu ticks
     20380254 idle cpu ticks
         3124 IO-wait cpu ticks
         2648 IRQ cpu ticks
         2085 softirq cpu ticks
          290 stolen cpu ticks
            0 non-nice guest cpu ticks
            0 nice guest cpu ticks
      1422665 K paged in
       234061 K paged out
            0 pages swapped in
            0 pages swapped out
          128 pages alloc in dma
       836782 pages alloc in dma32
            0 pages alloc in high
            0 pages alloc in movable
      3884041 pages alloc in normal
      5159077 pages free
      3513107 interrupts
      4963633 CPU context switches
   1735845729 boot time
        16123 forks

Frequently Asked Questions

What is the vmstat command and its purpose?

The vmstat command reports information about memory, paging, processes, disks, block IO, CPU activity, and traps.

Which package provides the vmstat command?

The command vmstat is provided by the procps or procps-ng package.

Relevant articles using the vmstat command

The following articles include an example on how to use vmstat and might be worth further exploring.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to vmstat:

Related and similar commands to vmstat
CommandCategorySummary
basenamefilesStrips directory and file name suffix from a given path
dmidecodehardwareShows hardware information
lscpumemoryCPU information, virtualization features, CPU vulnerabilities
numactlprocessesControls NUMA policy for processes and shared memory
pidstatmonitoringMonitoring CPU, memory, and disk activity
pmapprocessesShows memory mapping of process
prtstatprocessesShows process details for selected process like state, CPU and memory usage
pwdxprocessesShows current working directory of a process
slabtopmemoryShows slab usage of kernel
smemmemoryShow memory usage including swap
unamesystem informationShows basic system information

Also 💙 the command-line or terminal? Here is a set of cheat sheets for Linux to get more done from within the shell: