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

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0     92   6608   6796 192804    0    0   126    23  548  569  9  1 89  2  0
Example: Memory and CPU information is displayed three times at 10-second intervals.
#  vmstat 10 3

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0     92   6608   6796 192804    0    0   126    23  548  569  9  1 89  2  0
 0  0     92   5764   6828 192836    0    0     0     8 1090 1576  2  0 98  0  0
 1  0     92   7092   6844 191284    0    0     0    77 1085 1510  1  0 98  0  0
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

hda1          reads   read sectors  writes    requested writes
                 982       1970          2          4
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)
diskLocation 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
IOInput and output related information from the device
cur:Running IO
sec:Time used by IO
What the vmstat command displays( “p” option))
readsNumber of reads from the specified partition
read sectorsNumber of sectors read from the specified partition
writesNumber of writes to the specified partition
requested writesNumber of write requests to the specified partition
タイトルとURLをコピーしました