Pages

Tuesday, April 12, 2016

vmstat command one liners


vmstat by default will display the memory usage (including swap)

# vmstat

Where output of vommand can be understood as below,

    Procs – r: Total number of processes waiting to run
    Procs – b: Total number of busy processes
    Memory – swpd: Used virtual memory
    Memory – free: Free virtual memory
    Memory – buff: Memory used as buffers
    Memory – cache: Memory used as cache.
    Swap – si: Memory swapped from disk (for every second)
    Swap – so: Memory swapped to disk (for every second)
    IO – bi: Blocks in. i.e blocks received from device (for every second)
    IO – bo: Blocks out. i.e blocks sent to the device (for every second)
    System – in: Interrupts per second
    System – cs: Context switches
    CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time

To display active and inactive memory

# vmstat -a

To display number of forks since last boot. This displays all fork, vfork, and clone system call counts.

# vmstat -f

To execute vmstat every 2 seconds, you have to press Ctrl-C to stop this.

# vmstat 2

To execute vmstat every 2 seconds for 10 times

# vmstat 2 10

To display timestamp

# vmstat -t 1 100

To display version.

# vmstat –V

To display statistics in a table format

# vmstat -s

To display disk statistics

# vmstat -d

To increase the width of the display
(default without setting width)
# vmstat 1 3
(Setting width)
# vmstat -w 1 3

To display statistics for a partition

# vmstat -p sdb1

To display in statistics in MB


# vmstat -S m

No comments:

Post a Comment