Watch can help you monitor the running result of a command to monitor the result changes of all commands you want
Common command parameters
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 |
Common command display
Highlight changes in the number of network links every second
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 |
Highlight changes in the number of http links every second
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" |