vmstat command is used for performance monitoring of the system in Linux. It lists all the information such as processes, memory, swap, io, CPU, and system. Because of these functions, the vmstat command is also known as a virtual memory statistics report.
The values reported by the command are the average for each statistic since the computer was last restarted. These figures are not current values.
Below is the guide on how to use the vmstat command in Linux as we go through below.
The syntax of vmstat command
$ vmstat [options][delay [count]]
delay: is the interval between 2 updates. If you use the command without delay, it will print the average value since startup.
count: is the number of updates printed after each interval (sampling interval). If you use the command without count, the count value will be infinite.
free: show free memory.
si: virtual memory swapped.
so: virtual memory swapped out.
-a show active and inactive memory of the running system
$ vmstat -a
-f shows the number of forks
$ vmstat -f
-m show Slabinfo
$ vmstat -m
-s memory statistics and show event counter
$ vmstat -s
-d show drive statistics
$ vmstat -d
You have just seen a detailed tutorial on how to use the vmstat command in Linux.
Thank you for reading.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.