vmstat command is a Linux utility that provides a report on the system’s virtual memory statistics. It displays information about the system’s memory usage, I/O operations, and CPU activity. The command can be used to monitor system performance and diagnose problems.
vmstat command displays a summary of virtual memory statistics. It reports the following information:
- The number of processes running on the system
- The number of processes waiting for CPU time
- The amount of free memory available on the system
- The amount of memory being used as a disk cache
- The amount of memory being used as a buffer cache
- The amount of memory being used by the kernel
- The amount of memory being used by user processes
- The number of disk I/O operations per second
- The number of system calls per second
- The CPU utilization percentage
To run the
vmstat command, open a terminal window and type:
vmstat [options] [delay] [count]
options: Optional arguments that modify the output of the command.
delay: Optional delay between each report in seconds.
count: Optional number of reports to display.
For example, to display a report every two seconds, type:
To display five reports with a delay of one second between each report, type:
vmstat 1 5
vmstat command supports several options that modify the output of the command. The available options are:
||Display active and inactive memory information.|
||Display disk statistics.|
||Display the number of forks since boot.|
||Display slab and page cache memory statistics.|
||Display network statistics.|
||Display process-related statistics.|
||Display system statistics.|
||Display timestamp information.|
||Display swap statistics.|
vmstatshows high CPU utilization, identify the process that is consuming the most CPU time using the
vmstatshows high disk I/O operations, identify the process that is performing the most I/O operations using the
vmstatshows high memory usage, identify the process that is consuming the most memory using the
vmstatcommand is part of the
procps-ngpackage, which should be installed by default on most Linux distributions.
- The output of the
vmstatcommand may vary depending on the version of the command and the Linux distribution being used.