vmstat: System virtual memory statistics
August 9th, 2024 1:45 PM Mr. Q Categories: Command
Command: vmstat
The vmstat
command provides system information related to virtual memory, processes, paging, block IO, traps, and CPU activity. It’s useful for monitoring system performance and diagnosing issues related to memory and process management.
Sample Commands and Outputs:
- Command:
vmstat
Sample Command:
$ vmstat
Sample Output:
[vmstat output starts]
procs memory swap io system cpu
r b swpd free buff cache si so bi bo in cs us sy id
1 0 10240 20480 40960 81920 0 0 2 5 50 70 5 3 92
0 0 10240 20480 40960 81920 0 0 0 0 10 15 1 1 98
[vmstat output ends]
Description:
procs
: Information about processesr
: Number of processes waiting for run timeb
: Number of processes in uninterruptible sleep
memory
: Memory statisticsswpd
: Amount of virtual memory used (in KB)free
: Amount of idle memory (in KB)buff
: Amount of memory used as buffers (in KB)cache
: Amount of memory used as cache (in KB)
swap
: Swap space statisticssi
: Amount of memory swapped in from disk (in KB/s)so
: Amount of memory swapped out to disk (in KB/s)
io
: I/O statisticsbi
: Number of blocks received from a block device (in KB/s)bo
: Number of blocks sent to a block device (in KB/s)
system
: System statisticsin
: Number of interrupts per secondcs
: Number of context switches per second
cpu
: CPU statisticsus
: Time spent in user space (percentage)sy
: Time spent in system space (percentage)id
: Time spent idle (percentage)
Options:
-s [seconds]
: Set the delay between updates (e.g.,vmstat -s 5
updates every 5 seconds).-a
: Show active and inactive memory statistics.-d
: Show disk statistics.
Example with Options:
- Command:
vmstat -s
Sample Command:
$ vmstat -s
Sample Output:
[vmstat -s output starts]
10240 K total memory
20480 K free memory
40960 K buffer memory
81920 K cache memory
10240 K swap total
20480 K swap free
[vmstat -s output ends]
Description:
- Provides a summary of memory and swap usage, including total, free, and buffer/cache memory.