linux下2个检查tcp连接的命令
1检测web服务器的链接数量及状态:
netstat-ant|awk'{print$5"\t"$6}'|grep"::ffff:"|sed-e's/::ffff://'-e's/:[0-9]*//'|sort|uniq-c|sort-rn|head-10
结果:
122125.162.71.199TIME_WAIT
9979.119.125.43TIME_WAIT
81125.167.243.77TIME_WAIT
75110.137.106.75TIME_WAIT
29118.97.140.166TIME_WAIT
29115.192.138.175TIME_WAIT
2370.231.252.244TIME_WAIT
22114.58.168.27TIME_WAIT
17219.95.10.58TIME_WAIT
15125.160.90.214TIME_WAIT
检测所有的tcp连接数量及状态
netstat-ant|awk'{print$5"\t"$6}'|grep"[1-9][0-9]*\."|sed-e's/::ffff://'-e's/:[0-9]*//'|sort|uniq-c|sort-nr|head-10
结果:
14379.119.125.43TIME_WAIT
97110.137.106.75TIME_WAIT
54125.162.71.199TIME_WAIT
52121.120.140.19TIME_WAIT
31114.79.21.172TIME_WAIT
23118.97.140.166TIME_WAIT
1970.231.252.244TIME_WAIT
19114.58.168.27TIME_WAIT
18219.95.10.58TIME_WAIT
13115.192.138.175TIME_WAIT
有需要的朋友可以拿去收藏