watch
watch是个非常实用的命令,用于周期性执行某一程序,并全屏显示结果。因此,可以用来周期性检测任何一个想要的命令的执行结果。
参数命令
1.-n,–interval watch缺省每2秒运行一下程序,可以用-n或-interval来指定间隔的时间;
2. -d,–differences 用-d或–differences 选项watch 会高亮显示变化的区域。 而-d=cumulative选项会把变动过的地方(不管最近的那次有没有变动)都高亮显示出来;
实例
watch -n 1 -d ‘cat fyyy.log | grep status:’
其他参数
1.-b, --beep beep if command has a non-zero exit
2.-c, --color interpret ANSI color and style sequences
3.-e, --errexit exit if command has a non-zero exit
4.-g, --chgexit exit when output from command changes
5. -n, --interval seconds to wait between updates
6.-p, --precise attempt run command in precise intervals
7. -t, --no-title turn off header
8.-x, --exec pass command to exec instead of “sh -c”