Skip to main content
Topic: Useful Command of the Day vmstat - Report virtual memory statistics (Read 1316 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Useful Command of the Day vmstat - Report virtual memory statistics

NAME
       vmstat - Report virtual memory statistics

SYNOPSIS
       vmstat [option ...] [delay [count]]

DESCRIPTION
       vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.

       The  first report produced gives averages since the last reboot.  Additional reports give information on a sampling pe‐
       riod of length delay.  The process and memory reports are instantaneous in either case.

OPTIONS
       delay  The delay between updates in seconds.  If no delay is specified, only one report is  printed  with  the  average
              values since boot.

       count  Number of updates.  In absence of count, when delay is defined, default is infinite.

       -a, --active
              Display active and  inactive memory, given a 2.5.41 kernel or better.

       -f, --forks
              The  -f  switch displays the number of forks since boot.  This includes the fork, vfork, and clone system calls,
              and is equivalent to the total number of tasks created.  Each process is represented by one or more  tasks,  de‐
              pending on thread usage.  This display does not repeat.

       -m, --slabs
              Displays slabinfo.

       -n, --one-header
              Display the header only once rather than periodically.

       -s, --stats
              Displays a table of various event counters and memory statistics.  This display does not repeat.


       -d, --disk
              Report disk statistics (2.5.70 or above required).

       -D, --disk-sum
              Report some summary statistics about disk activity.

       -p, --partition device
              Detailed statistics about partition (2.5.70 or above required).

       -S, --unit character
              Switches  outputs  between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes.  Note this does not change the
              block (bi/bo) fields.

       -t, --timestamp
              Append timestamp to each line

       -w, --wide
              Wide output mode (useful for systems with higher amount of memory, where the default output  mode  suffers  from
              unwanted column breakage).  The output is wider than 80 characters per line.

       -y, --no-first
              Omits first report with statistics since system boot.

       -V, --version
              Display version information and exit.

       -h, --help
              Display help and exit.


man vstat

Code: [Select]
flatbush:[ruben]:~$ vmstat 1 20
procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st gu
 2  0      0 14789768 2072 38689652  0    0     5   229 2617    8 13  2 85  0  0  0
 1  0      0 14788520 2072 38689688  0    0     0     0 2825 8925 12  2 86  0  0  0
 0  0      0 14768436 2072 38689816  0    0     0   100 3207 9295 16  2 82  0  0  0
 1  0      0 14767788 2072 38689816  0    0     0  2216 2748 8530 12  3 86  0  0  0
 7  1      0 14767236 2072 38689264  0    0     0   984 4323 11886 14 4 82  0  0  0
 3  0      0 14763660 2072 38689800  0    0     0     0 2926 9409 14  2 84  0  0  0
 1  0      0 14771048 2072 38689800  0    0     0    24 3007 8986 13  2 85  0  0  0
 1  0      0 14771056 2072 38689800  0    0     0     0 2897 8855 13  3 84  0  0  0
 0  0      0 14765836 2072 38689592  0    0     0   100 4562 12909 17 3 80  0  0  0
 1  0      0 14770188 2072 38684968  0    0     0   984 2910 9275 11  2 87  0  0  0
 0  0      0 14770188 2072 38684968  0    0     0     0 2751 8651 11  3 86  0  0  0
 1  0      0 14770188 2072 38685032  0    0     0     0 2731 8544 13  2 85  0  0  0
 4  1      0 14778228 2072 38684816  0    0     0  1040 4315 12324 15 3 82  0  0  0
 1  0      0 14768664 2072 38684968  0    0     0     0 2869 9137 12  2 85  0  0  0
 0  0      0 14768648 2072 38685032  0    0     0    72 2803 8896 12  3 85  0  0  0
 1  0      0 14768540 2072 38685012  0    0     0     0 2719 8531 11  2 87  0  0  0
 0  0      0 14765912 2072 38684752  0    0     0     0 4140 11729 13 3 84  0  0  0
 1  0      0 14760692 2072 38685028  0    0     0   980 2852 9052 13  3 84  0  0  0
 0  0      0 14762616 2072 38685028  0    0     0   152 2707 8480 11  2 87  0  0  0
 1  0      0 14768740 2072 38684704  0    0     0    12 2729 8636 11  2 87  0  0  0

Code: [Select]
flatbush:[ruben]:~$ vmstat 1 4 -d
disk- ------------reads------------ ------------writes----------- -----IO------                                                                        
       total merged sectors      ms  total merged sectors      ms    cur    sec
sda   235619   4574 11771113 2918690 5954736 246907 606033978 109295953      0  27424
sdc      249      0    9301    5119      0      0       0       0      0      5
sr0        0      0       0       0      0      0       0       0      0      0
sde        0      0       0       0      0      0       0       0      0      0
sdf        0      0       0       0      0      0       0       0      0      0
sdg        0      0       0       0      0      0       0       0      0      0
sdd      262      0    9032    1091      0      0       0       0      0      0
sdb       74      0    2655     444      0      0       0       0      0      0
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
sda   235619   4574 11771113 2918690 5954736 246907 606033978 109295953      0  27424
sdc      249      0    9301    5119      0      0       0       0      0      5
sr0        0      0       0       0      0      0       0       0      0      0
sde        0      0       0       0      0      0       0       0      0      0
sdf        0      0       0       0      0      0       0       0      0      0
sdg        0      0       0       0      0      0       0       0      0      0
sdd      262      0    9032    1091      0      0       0       0      0      0
sdb       74      0    2655     444      0      0       0       0      0      0
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
sda   235619   4574 11771113 2918690 5954738 246907 606034026 109295953      0  27424
sdc      249      0    9301    5119      0      0       0       0      0      5
sr0        0      0       0       0      0      0       0       0      0      0
sde        0      0       0       0      0      0       0       0      0      0
sdf        0      0       0       0      0      0       0       0      0      0
sdg        0      0       0       0      0      0       0       0      0      0
sdd      262      0    9032    1091      0      0       0       0      0      0
sdb       74      0    2655     444      0      0       0       0      0      0
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
sda   235619   4574 11771113 2918690 5954738 246907 606034026 109295953      0  27424
sdc      249      0    9301    5119      0      0       0       0      0      5
sr0        0      0       0       0      0      0       0       0      0      0
sde        0      0       0       0      0      0       0       0      0      0
sdf        0      0       0       0      0      0       0       0      0      0
sdg        0      0       0       0      0      0       0       0      0      0
sdd      262      0    9032    1091      0      0       0       0      0      0
sdb       74      0    2655     444      0      0       0       0      0      0

https://phoenixnap.com/kb/vmstat-command
https://www.linuxbash.sh/post/vmstat-virtual-memory-and-system-stats