查看當前系統所有的監聽端口:

 nc -zv localhost 1-65535
#后面是端口號的起始值,只列出此端口是否被使用,而不列出使用進程ID

或者
sudo netstat -antup
#列出占用端口的進程ID