linux watch 命令使用;进行循环执行程序,并显示结果;

watch 能间歇地执行程序,并将输出结果以全屏的方式显示,默认时2s执行一次;

watch -n 5 ping -c 1 www.baidu.com # 进行循环5秒钟,发送一次ping包;

使用范例:

To watch for mail, you might do

              watch -n 60 from

       To watch the contents of a directory change, you could use

              watch -d ls -l

       If you're only interested in files owned by user joe, you might use

              watch -d 'ls -l | fgrep joe'

       To see the effects of quoting, try these out

              watch echo $$
              watch echo '$$'
              watch echo "'"'$$'"'"

更多文档,请直接查找man手册;非常好用的工具,我今天才知道。。

保持更新,更多内容请关注 cnblogs.com/xuyaowen;

posted @ 2019-11-25 15:16  Michael-Xu  阅读(852)  评论(0编辑  收藏  举报