天天看點

netstat檢視系統連接配接數及目前連接配接IP

1.檢視目前連接配接IP位址:

[root@centos69 ~]# netstat -nat

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address    Foreign Address       State      

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      

tcp        0      0 192.168.1.200:22   192.168.1.162:52265   ESTABLISHED 

tcp        0      0 :::22                       :::*                        LISTEN      

tcp        0      0 ::1:25                      :::*                        LISTEN      

2.檢視80端口連接配接數

netstat -nat|grep -i '80'|wc -l

3.檢視目前連接配接狀态數量如LISTEN /ESTABLISHED /tcp

netstat -na|grep LISTEN|wc -l

4.檢視連接配接IP

netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'

5.netstat --help使用方法

本文轉自  一招拜師  51CTO部落格,原文連結:http://blog.51cto.com/sadoc/1932028