前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux watch命令

linux watch命令

作者头像
用户5807183
发布2019-08-22 10:10:19
1.2K0
发布2019-08-22 10:10:19
举报
文章被收录于专栏:Linux知识积累Linux知识积累

watch可以帮你监测一个命令的运行结果,来监测你想要的一切命令的结果变化

常见命令参数

代码语言:javascript
复制
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                        turns off showing the header

常见命令展示

每隔一秒高亮显示网络链接数的变化情况

代码语言:javascript
复制
watch -n 1 -d netstat -ant 【-n 设置间隔,-d,difference,高亮显示不同】

   watch -d 'ls /home/omd'       【-d 高亮显示】

   watch -t 'ls /home/omd'       【-t会关闭watch命令在顶部的时间间隔】

说明: 切换终端:Ctrl+x     退出watch:Ctrl+g

每隔一秒高亮显示http链接数的变化情况

代码语言:javascript
复制
watch -n 1 -d 'pstree|grep http'

实时查看模拟攻击客户机建立起来的连接数

watch -n 1 -d 'netstat -an | grep "21" | egrep "192.168.25.100"| wc -l'

监测当前目录中 scf' 的文件的变化

watch -d 'ls -l|grep scf'

10秒一次输出系统的平均负载

watch -n 1 -d "uptime"
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-08-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Linux知识积累 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 常见命令参数
  • 常见命令展示
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档