netstat

  1. 列出所有连接

    $ netstat -a
    
  2. 禁用反向域名解析,加快查询下速度

    $ netstat -ant
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State      
    tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
    tcp        0      0 192.168.1.2:49058       173.255.230.5:80        ESTABLISHED
    tcp        0      0 192.168.1.2:33324       173.194.36.117:443      ESTABLISHED
    tcp6       0      0 ::1:631                 :::*                    LISTEN
    
  3. 只列出监听中的连接

    $ netstat -tnl
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State      
    tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
    tcp6       0      0 ::1:631                 :::*                    LISTEN
    

你可能感兴趣的:(netstat)