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