vmstat command
LINUX-Frequently used commands
vmstat command Display load factor and usage of memory and CPU. |
Syntax |
vmstat [Option] |
vmstat is a command that displays information about the system. For example, it displays the free space in the main memory, the CPU status, etc. If you run the vmstat command verbatim, you will see the current process, memory, swap, device, interrupt, and CPU information. With the -d and -p options, you can see the status of reading and writing to partitions and disks.. If the -f option is specified, the number of times a process was created between the time the system was started and the time the command was executed is displayed. If you specify a time interval in seconds after vmstat, the system status will be displayed at each specified time. If you specify a number of times, the information for the specified number of times will be displayed. The unit of capacity can be specified with the "-S" option. If you specify "-S M", the unit of capacity is displayed in M bytes. |
Frequently used options |
-f Display the number of forks (the number of times a process has been created) -n Display the header only once -s Display each piece of information with its detailed information name -d Display statistics for a given partition -S <unit> Displays the capacity in the specified units. k is 1,000, K is 1,024, m is 1,000,000, M is 1,048,576 bytes Display in units |
Example: View statistics. | ||
$ su - ← Become a super user root Password: Enter root password # vmstat
|
Example: Memory and CPU information is displayed three times at 10-second intervals. | ||
# vmstat 10 3
|
Example: Display the number of fork. |
# vmstat -f 356579 forks |
Example: Display information about reading and writing to partition /dev/hda1. | ||
# vmstat -p /dev/hda1
|
What the vmstat command displays(No options) | |
procs | Statistics on active processes |
r:Number of processes waiting to run | |
b:Number of processes in non-interruptible sleep state | |
w:Number of processes swapped out and executable | |
memory | Data on the amount of memory used and available |
swpd:Amount of virtual memory | |
free:Amount of free memory (Kbytes) | |
buff:Amount of memory used as buffer (Kbytes) | |
swap | Statistics on swaps |
si:Amount of memory being swapped in from disk(Kバイト/秒) | |
so:Amount of memory swapped to disk (Kbytes/second) | |
iO | Transfer volume to and from devices |
bi:Number of blocks received from the block device(blocks/second) | |
bo:Number of blocks sent to the block device (blocks/second) | |
system | System-wide interrupt and context switching rates |
in:Number of interruptions per second | |
cs:Number of context switches per second | |
cpu | Percentage of CPU usage |
us:User time | |
sy:System time | |
id:Idle time | |
wa:IO waiting time |
What the vmstat command displays( "d" option) | |
disk | Location of the file system |
reads:Information about reading | |
total:Total number of successful reads | |
merged:Number of reads (when grouped) | |
sectors:Number of sectors successfully read | |
ms:Time taken to read | |
writes | Information on writing |
total:Total number of successful writes | |
merged:Number of posts (when grouped) | |
sectors:Number of successfully written sectors | |
ms:Time taken to write | |
IO | Input and output related information from the device |
cur:Running IO | |
sec:Time used by IO |
What the vmstat command displays( "p" option)) | |
reads | Number of reads from the specified partition |
read sectors | Number of sectors read from the specified partition |
writes | Number of writes to the specified partition |
requested writes | Number of write requests to the specified partition |