2025年3月30日 星期日 甲辰(龙)年 月廿九 夜 设为首页 加入收藏
rss
您当前的位置:首页 > 计算机 > 系统应用 > Linux

Linux命令——watch

时间:08-01来源:作者:点击数:29
城东书院 www.cdsy.xyz

watch是周期性的执行下个程序,并全屏显示执行结果

用法:

  • vm@fedora:~$ watch --help
  • Usage:
  • watch [options] command
  • Options:
  • -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 exit
  • For more details see watch(1).

用例:

每隔两秒执行一次uptime查看系统负载:

  • watch -n 2 uptime
城东书院 www.cdsy.xyz
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门
本栏推荐