1.查看當前鏈接IP地址:centos
[root@centos69 ~]# netstat -nattcp
Active Internet connections (servers and established)ide
Proto Recv-Q Send-Q Local Address Foreign Address State spa
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN .net
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN server
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN it
tcp 0 0 192.168.1.200:22 192.168.1.162:52265 ESTABLISHED io
tcp 0 0 :::22 :::* LISTEN class
tcp 0 0 ::1:25 :::* LISTEN awk
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使用方法