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, troubleshootingInstallation
When vmstat is not installed by default, it can be added to the system using the relevant software package.
Package information for vmstat
Operating system | Package name | Installation |
---|---|---|
AlmaLinux | procps-ng |
|
Arch Linux | procps-ng |
|
Debian | procps |
|
Fedora | procps-ng |
|
openSUSE | procps |
|
Red Hat Enterprise Linux | procps-ng |
|
Rocky Linux | procps-ng |
|
Ubuntu | procps |
|
Your Linux distribution using a different package? Share your feedback.
Usage
Available options
Long option | Short option | Description |
---|---|---|
--active | -a | Active and inactive memory |
--forks | -f | Number of forks since boot |
--slabs | -m | Slab information |
--one-header | -n | Header displayed once |
--stats | -s | Event counters and memory statistics |
--disk | -d | Disk statistics |
--disk-sum | -D | Disk activity summary |
--partition device | -p | Statistics about partition |
--unit character | -S | Change output unit (k=1000, K=1024, m=1000000, M=1048576) |
--timestamp | -t | Include timestamp with each line |
--wide | -w | Wide output, useful when output does not fit |
--version | -v | Version information |
--help | -h | Display 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.
Column | Section | Description |
---|---|---|
active | memory | Amount of active memory when using --active |
b | procs | Number of process that are in blocked state as they are waiting for IO to complete (e.g. network / disk) |
bi | io | Amount received from a block device (KiB/s) |
bo | io | Amount sent to a block device (KiB/s) |
buff | memory | Amount of memory used as buffers |
cache | memory | Amount of memory used as cache |
cs | system | Number of context switches per second |
free | memory | Amount of idle memory |
gu | cpu | Time spent running KVM guest code (guest time, including guest nice) |
id | cpu | Time spent idle |
in | system | Number of interrupts per second, including the clock |
inact | memory | Amount of inactive memory when using --active |
r | procs | Number of runnable processes that are running or waiting for in runqueue |
si | swap | Amount of memory swapped in from the disk (per second) |
so | swap | Amount of memory swapped to the disk (per second) |
swpd | memory | Amount of swap memory used |
us | cpu | Time spent running non-kernel code (user time, including nice time) |
st | cpu | Time stolen from a virtual machine |
sy | cpu | Time spent running kernel code (system time) |
wa | cpu | Time 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.
- Understanding memory information on Linux systems
- How to monitor disk activity (I/O) on Linux
- Swap memory information
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:
Command | Category | Summary |
---|---|---|
basename | files | Strips directory and file name suffix from a given path |
dmidecode | hardware | Shows hardware information |
lscpu | memory | CPU information, virtualization features, CPU vulnerabilities |
numactl | processes | Controls NUMA policy for processes and shared memory |
pidstat | monitoring | Monitoring CPU, memory, and disk activity |
pmap | processes | Shows memory mapping of process |
prtstat | processes | Shows process details for selected process like state, CPU and memory usage |
pwdx | processes | Shows current working directory of a process |
slabtop | memory | Shows slab usage of kernel |
smem | memory | Show memory usage including swap |
uname | system information | Shows 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: