watch命令

wacth命令是linux中一个非常好用的工具,可以用来观察单位时间内指定命令的执行情况。

 

使用方法:

Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>
  -d, --differences[=cumulative]        highlight changes between updates
                (cumulative means highlighting is cumulative)
  -h, --help                            print a summary of the options
  -n, --interval=<seconds>              seconds to wait between updates
  -v, --version                         print the version number
  -t, --no-title   

 

常用形式:

watch -d -n [interval] 'command'

其中:

  -d用来显示前后2次命令执行的不同

  -n用来指定执行2次命令的时间间隔,最小单位为0.1s

如:

watch -d -n 0.1 'ps -ef|grep "expression"'

 

posted @ 2014-10-16 11:16  lichmama  阅读(275)  评论(0编辑  收藏  举报