-r, --route 显示路由表
-i, --interfaces display interface table
-g, --groups display multicast group memberships
-s, --statistics display networking statistics (like SNMP)
-M, --masquerade display masqueraded connections
-v, --verbose 显示详细信息
-W, --wide don't truncate IP addresses
-n, --numeric 不解析名称
--numeric-hosts 不解析主机名
--numeric-ports 忽略端口名称
--numeric-users 忽略用户名
-N, --symbolic resolve hardware names
-e, --extend 显示更多信息
-p, --programs display PID/Program name for sockets
-o, --timers display timers
-c, --continuous continuous listing
-l, --listening display listening server sockets
-a, --all display all sockets (default: connected)
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
-Z, --context display SELinux security context for sockets
$ netstat -a|head -n 5
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
*************
$ netstat -at|head
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:ipp 0.0.0.0:* LISTEN
*************
$ netstat -au|head
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 0.0.0.0:46997 0.0.0.0:*
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
***********************
$ netstat -l|head
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:ipp 0.0.0.0:* LISTEN
tcp6 0 0 [::]:hostmon [::]:* LISTEN
netstat -lt : 列出所有netstat -lt 列出所有监听 tcp 端口
$netstat -lu 列出所有监听 udp 端口
$netstat -lx 列出所有监听 UNIX 端口
$netstat -s 显示所有端口
$netstat -st 显示TCP的端口
$netstat -su 显示UDP的端口
$ sudo netstat -nltp|grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1312/sshd
tcp6 0 0 :::22 :::* LISTEN 1312/sshd