Unix 查看服务的端口情况

nmap localhost   ###也是查看系统运行的服务所对应的端口

 

cat /etc/services  ###所有程序的默认端口列表都在这里了

 

netstat -an          ####查看系统运行时端口的状态 # 这会打印所有端口的状态 最好后面加上grep 和more

 

netstat -an|grep "port"|more

 

netstat -antp ## t param means tcp,u means udp ,p means program/pid
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      701/vsftpd      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      737/sshd        
tcp        0      0 127.0.0.1:9391          0.0.0.0:*               LISTEN      763/openvassd: Wait
tcp        0      0 127.0.0.1:9392          0.0.0.0:*               LISTEN      662/gsad        
tcp        0      1 192.168.0.116:41402     37.61.54.158:443        SYN_SENT    1632/iceweasel  
tcp        0      0 192.168.0.116:56701     54.192.117.79:80        ESTABLISHED 1632/iceweasel  
tcp        0      0 192.168.0.116:56699     54.192.117.79:80        ESTABLISHED 1632/iceweasel  
tcp        0      0 192.168.0.116:56700     54.192.117.79:80        ESTABLISHED 1632/iceweasel  

 

转载于:https://my.oschina.net/u/2308739/blog/601687