Getting to Know the Vmstat Command in Linux

04 May 2023 Balmiki Mandal 0 Linux

What is Vmstat Command in Linux?

The vmstat command in Linux is a tool that provides information about virtual memory statistics. It displays figures on processor, memory, page, swap, IO and system activities as well as interrupts since the last reboot.

How to Use Vmstat Command?

The general syntax to use the vmstat command is:

vmstat [options] [delay [count]]

Where "delay" specifies the delay in seconds between each update of the report and "count" is the number of times the report should be generated. If not specified, the default values are "1" for delay and "infinity" for count.

Examples of Vmstat Command

Typing "vmstat" without any options will generate a report of the current system activity.

$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st 
 0  0      0 304884  70764 148356    0    0     6    32   71   80  5  1 94  0  0

The "vmstat 1 5" will generate 5 updates of the report every second.

$ vmstat 1 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st 
 0  0      0 308548  70960 147424    0    0     0     6   24   28  4  1 95  0  0
 0  0      0 308612  70960 147432    0    0     0     0  425  455  0  0 100  0  0
 0  0      0 308612  70960 147432    0    0     0     0   54   55  0  0 100  0  0
 0  0      0 308612  70960 147432    0    0     0     0   34   36  0  0 100  0  0
 0  0      0 308612  70960 147432    0    0     0     0   53   57  0  0 100  0  0

Conclusion

Thus, the vmstat command in Linux is an important tool for monitoring virtual memory statistics. It is useful for detecting memory leakage, performance issues etc.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.