watch是周期性的执行下个程序,并全屏显示执行结果
用法:
vm@fedora:~$ watch --helpUsage:watch [options] commandOptions:-b, --beep beep if command has a non-zero exit-c, --color interpret ANSI color and style sequences-d, --differences[=<permanent>]highlight changes between updates-e, --errexit exit if command has a non-zero exit-g, --chgexit exit when output from command changes-q, --equexit <cycles>exit when output from command does not change-n, --interval <secs> seconds to wait between updates-p, --precise attempt run command in precise intervals-r, --no-rerun do not rerun program on window resize-t, --no-title turn off header-w, --no-wrap turn off line wrapping-x, --exec pass command to exec instead of "sh -c"-h, --help display this help and exit-v, --version output version information and exitFor more details see watch(1).
用例:
每隔两秒执行一次uptime查看系统负载:
watch -n 2 uptime