linux 查看端口是否被占用

1、使用lsof

lsof -i:端口号查看某个端口是否被占用

 lsof -i:80

2、使用netstat

netstat -anp|grep 80 

3、netstat常用命令

netstat -ntlp   //查看当前所有tcp端口·
netstat -ntulp |grep 80   //查看所有80端口使用情况·
netstat -an | grep 3306   //查看所有3306端口使用情况·
原文地址:https://www.cnblogs.com/mandywang/p/11225465.html