运维联盟俱乐部

 找回密码
 立即注册
查看: 1782|回复: 0

watch

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2021-8-22 00:04:00 | 显示全部楼层 |阅读模式
    watch可以帮你监测一个命令的运行结果,来监测你想要的一切命令的结果变化
    常见命令参数watch可以帮你监测一个命令的运行结果,来监测你想要的一切命令的结果变化
    常见命令参数
    1
    2
    3
    4
    5
    6
    7
    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



    常见命令展示每隔一秒高亮显示网络链接数的变化情况
    1
    2
    3
    4
    5
    6
    7
    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链接数的变化情况
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    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"


    常见命令展示每隔一秒高亮显示网络链接数的变化情况
    1
    2
    3
    4
    5
    6
    7
    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链接数的变化情况
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    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"


    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-4 21:13 , Processed in 0.054267 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表