Open In App

vmstat command in Linux with Examples

vmstat command in Linux/Unix is a performance monitoring command of the system as it gives the information about processes, memory, paging, block IO, disk, and CPU scheduling. All these functionalities makes the command vmstat also known as virtual memory statistic reporter

The very first report produced gives the average details since the last reboot. After that, additional reports are produced which provides report over a sampling period of time. All these process and reports are instantaneous in either case. 



Syntax: 

vmstat [options][delay [count]]

Delay: It is the time interval in between two updates. It can be termed as a sampling period after each interval of the sampling period report that will be printed with the updated details. If there will be no delay specified only one report will be printed with average value since boot. 



Count: It is the number of updates which is printed after each interval(sampling period). In absence of count and delay is specified, the default value of count is infinite

Note: Important fields are ‘free’ under memory and ‘si’, ‘so’ under the swap column. 

Options:  

$vmstat -a

Example: The given figure shows how to use the command. The best part of it is we can see how much memory is actively used and how much is inactive. 

$vmstat -f

Example: The given figure illustrates the number of forks. There is the 1832 fork process. 

$vmstat -m

Example: The given figure shows that the kernel is not supporting slab info. It depends on your kernel which you are using. 

$vmstat -s

Example: The figure given below shows the table of various event counters. 

$vmstat -d

Example: The figure shows all disk statistics. 

$vmstat -t delay count

Example: Along with the process there lies time of each update. By default memory status is shown in kilobytes, but when we want to see it in other forms we need a different command. 

$vmstat -S M delay count

Example: The memory is shown in MB here in the given figure. 

$vmstat -n

Example: The figure illustrates the use. 

$ man vmstat

 

Article Tags :