netstat 命令可以帮助检查本机的网络状况,man netstat 可以看到对其的基本描述:
netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
显示tcp协议
先来一个简单的例子,要显示tcp协议,使用-t参数,包括了tcp和tcp6
netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:59226 localhost:8527 ESTABLISHED
tcp 0 0 bogon:44385 117.79.93.222:http TIME_WAIT
tcp 0 0 localhost:8527 localhost:59305 CLOSE_WAIT
tcp 0 0 localhost:8527 localhost:59235 ESTABLISHED
tcp 0 1 bogon:36113 tf-in-f19.1e100.n:https SYN_SENT
tcp 0 0 bogon:49941 117.79.93.196:http TIME_WAIT
tcp 0 0 bogon:53574