另一个选择是ss。它更容易使用...。
以下命令将仅输出当前侦听套接字的列表。
root@server:~# ss -l
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
u_dgr UNCONN 0 0 * 23353 * 23352
u_dgr UNCONN 0 0 * 568 * 362
u_dgr UNCONN 0 0 * 14836 * 14837
u_dgr UNCONN 0 0 * 20446 * 369
u_dgr UNCONN 0 0 * 22877 * 369
u_dgr UNCONN 0 0 * 504 * 347
u_dgr UNCONN 0 0 * 16298 * 369
u_dgr UNCONN 0 0 * 23343 * 369
u_dgr UNCONN 0 0 * 24125 * 369
u_dgr UNCONN 0 0 * 24617 * 369
u_dgr UNCONN 0 0 * 23352 * 23353
u_dgr UNCONN 0 0 * 23334 * 369
u_dgr UNCONN 0 0 * 17113 * 369
u_dgr UNCONN 0 0 * 16957 * 369
u_dgr UNCONN 0 0 * 14793 * 362
u_dgr UNCONN 0 0 * 23345 * 362
u_dgr UNCONN 0 0 * 24070 * 369
udp UNCONN 0 0 *:sunrpc *:*
udp UNCONN 0 0 *:981 *:*
udp UNCONN 0 0 :::sunrpc :::*
udp UNCONN 0 0 :::981 :::*
tcp LISTEN 0 128 127.0.0.1:85 *:*
tcp LISTEN 0 128 *:ssh *:*
tcp LISTEN 0 128 *:3128 *:*
tcp LISTEN 0 100 127.0.0.1:smtp *:*
tcp LISTEN 0 128 *:8006 *:*
tcp LISTEN 0 128 *:sunrpc *:*
tcp LISTEN 0 128 :::ssh :::*
tcp LISTEN 0 100 ::1:smtp :::*
tcp LISTEN 0 128 :::sunrpc :::*