上文介绍了工具mpstat和iostat,接着要介绍的是vmstat的使用,由于free和ping经常遇到,所以简单概述:
6> vmstat:虚拟内存统计
描述:
  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 period of length delay.  The process and memory reports are instantaneous in either case.
用法:
  vmstat [-a] [-n] [delay [ count]]
  vmstat [-f] [-s] [-m]
  vmstat [-S unit]
  vmstat [-d]
  vmstat [-D]
  vmstat [-p disk partition]
  vmstat [-V]
选项:
  -a 						#显示活动/非活动的内存
  -f 						#显示从开机到现在的forks的数目,等同于任务的创建总数
  -n 						#只显示头部一次
  -s 						#显示一个表包含各种事件计数器和内存统计
  delay 					#刷新时间间隔
  count 					#刷新次数
  -d 						#显示磁盘相关统计信息
  -D 						#显示活动的磁盘概要统计信息
  -p 						#指定磁盘分区统计信息
  -S						#使用指定单位显示。参数有k K m M ,分别代表1000 1024 1000000 1048576字节(byte)默认单位为K(1024 bytes)
  -V						#显示vmstat版本信息。
字段描述:
 Procs
   r						#等待运行的进程的数量
   b						#睡眠的进程的数量
 Memory 
   swpd						#已使用的虚拟内存大小
   free						#空闲的内存大小
   buff						#缓冲区的内存大小
   cache					#用于高速缓存的内存大小
   inact					#不活跃的内存大小(-a option)
   active					#活跃的内存大小(-a option)
 Swap
   si					        #从磁盘交换到内存的数量(/s)
   so						#从内存交换到磁盘的的数量(/s)
   IO
   bi						#从一个块设备接收到的块数量(blocks/s)
   bo						#发送给一个块设备的块数量(blocks/s)
 System
   in						#每秒的中断数,包含时间中断
   cs						#每秒上下文切换的数
   CPU						#总CPU时间的百分比
   us						#运行非内核程序的时间(user time, including nice time)
   sy						#运行内核程序的时间
   id						#系统空闲时间(Prior to Linux 2.5.41, this includes IO-wait time)
   wa					        #用在IO等待的时间
   st						#从一虚拟机窃取的时间
示例:(很简单,不再多说)
  $ vmstat 2 
  $ vmstat 2 5
  $ vmstat -s
6> free:显示空闲和使用的内存
用法
free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V]
参数
 -b 						#以bytes显示内存数量
 -g 						#以gigabytes显示内存数量	
 -k 						#以kilobytes显示内存数量(默认)
 -m 						#以megabytes显示内存数量
 -l 						#显示详细的高低内存统计
 -c count 				        #显示几次结果,须和-s一起使用
 -s delay 					#时间间隔
 -V 						#显示版本号
 -o 						#以旧版本方式输出,仅仅是没有buffer adjusted行
 -t 						#显示一个总计的行

更多详情请参考手册$ man free
7> ping:send ICMP ECHO_REQUEST to network host
用法:
ping [-LRUbdfnqrvVaAB] [-c count] [-m mark] [-i interval] [-l preload] [-p pattern] [-s packetsize] [-t ttl] [-w deadline] [-F flowlabel] [-I interface] [-M hint] [-N nioption] [-Q tos] [-S sndbuf] [-T timestamp option] [-W timeout] [hop ...] destination
几个参数:
 -c count  					#指定数值,执行ping的次数
 -s packetsize 					#发送出去的ICMP包的大小默认56bytes,再加8bytes的ICMP表头数据,共64bytes
 -i interval					#设定每次执行的间隔秒数
示例:
$ ping -c 5 www.baidu.com