1.列出所有的端口
netstat -a
列出TCP協議的端口
netstat -at
UDP協議的端口
netstat -au
2.列出處于監聽狀態的socket
netstat -l
列出監聽的TCP端口
netstat -lt
列出監聽的UDP端口
netstat -lu
列出監聽的UNIX端口
netstat -lx
3.列出協議的統計信息
nestat -s
比如: Ip:
11150 total packets received
1 with invalid addresses
0 forwarded
0 incoming packets discarded
11149 incoming packets delivered
11635 requests sent out
Icmp:
0 ICMP messages received
0 input ICMP message failed.
Tcp:
582 active connections openings
2 failed connection attempts
25 connection resets received
Udp:
1183 packets received
4 packets to unknown port received.
列出TCP協議的統計信息
nestat -st
列出UDP協議的統計信息
netstat -su
4.顯示進程ID和名稱
nestat -p
其中-p選項可以和其它選項結合使用。
5.輸出中不解析主機、端口、名稱
netstat -n
6.持續打印netstat信息
netstat -c
7.列出不支持的地址族
netstat –verbose
8.列出內核的路由信息
netstat -r
9.列出在端口上運行的程序
netstat -ap
netstat -an | grep ‘:80’
10.列出網絡接口信息
netstat -i