查看进程占用的端口
- 查看进程的 Pid
ps -ef | grep <进程名称>
- 查看 Pid 对应的端口号
netstat -nltp | grep <Pid>
查看使用某个端口号的进程
- 使用 lsof 命令
lsof -i:8080
netstat
netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn |head -n 10
ps -ef | grep <进程名称>
netstat -nltp | grep <Pid>
lsof -i:8080
netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn |head -n 10