您的位置:首页 > 理论基础 > 计算机网络

watch 命令 Linux下很有用 比如 配合 netstat 查看 tcp以及一些端口活动 watch -n 1 netstat -ant

2011-04-23 14:35 756 查看
今天复习一些TCP传输的知识,用watch -n 1 netstat -ant 然后刷新一个页面,看看,很有意思

一.watch作用
可以周期性的,重复的查看命令的输出结果

watch - execute a program periodically, showing output fullscreen

二.watch参数
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

-d 比较不同 ,高亮显示
-h help
-v 版本
-t 关闭header

具体参数,可以自己试试

三.具体应用,查看TCP连接的端口活动,进程状态(间隔1秒)
先执行一下命令,然后刷新一次browser,然后就可以看看终端的输出结果了

watch -n 1 netstat -ant

声明:本文档可以随意更改,但必须署名原作者

作者:凤凰舞者 qq:578989855
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: