Think before you speak, read before you think.

watch进行持续输出

by

in

用 watch 在测试的时候可以跟进输出

每一秒钟刷新一次

watch -n 1 'netstat -nat | grep 211.148.19.12'

如果想要持续性的查看,可以写到日志中

watch -n1 'netstat -nat | grep 211.148.19.12| tee -a netstat.log'

或者使用 sleep 来输出每一次的执行

while sleep 1; do netstat -nat | grep 211.148.19.12; done

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *