Linux 实用指令之查看端口开启情况

netstat -ntlp

查看端口使用情况!

netstat -ntlp | grep 80

 

查看具体的端口是否使用!

# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      2247/redis-server 1 
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1365/rpcbind        
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      32169/nginx         
tcp        0      0 0.0.0.0:39922               0.0.0.0:*                   LISTEN      1383/rpc.statd      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1670/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1509/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2265/sendmail       
tcp        0      0 :::53294                    :::*                        LISTEN      1383/rpc.statd      
tcp        0      0 :::111                      :::*                        LISTEN      1365/rpcbind        
tcp        0      0 :::22                       :::*                        LISTEN      1670/sshd           
tcp        0      0 ::1:631                     :::*                        LISTEN      1509/cupsd          
tcp        0      0 :::3306                     :::*                        LISTEN      15856/mysqld        
THE END