日期:2014-05-16  浏览次数:20707 次

在GNU/Linux中查看端口占用情况的命令

/*********************************************************************
 * Author  : Samson
 * Date    : 04/08/2014
 * Test platform:
 *              Linux debian-IDS 3.13.7
 *              GNU bash, version 4.2.37
 * *******************************************************************/


第一种方法:

root@debian:/home/# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:33223           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 :::60042                :::*                    LISTEN     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 111.111.111.120:80      111.111.111.114:1119    ESTABLISHED
tcp6       0      0 111.111.111.120:80      111.111.111.114:1123&nbs