Linux vmstat Command: Usage & Examples

The “vmstat” command is used to monitor the system’s virtual memory usage. It provides performance data on aspects such as memory, swap space, and I/O.

Here is a basic usage of the vmstat command:

vmstat [options] [delay [count]]

If delay and count are not specified, vmstat will continuously output performance data, with delay indicating the time interval between output data and count indicating the number of output data.

Common options include:

  1. Display information about active and inactive memory.
  2. -f: Display the number of times the system has forked since startup.
  3. -s: display usage of memory and swap space.
  4. -m: display memory usage.
  5. -p: Specify the process ID to monitor, showing only information for the specified process.

For example, you can use the following command to check the system’s memory and swap space usage:

vmstat -s

By using the vmstat command, users can monitor system performance data in real-time, helping them understand the system’s operation and make necessary optimizations.

bannerAds