1.查看已连接的服务端口 (ESTABLISHED)
netstat -a
2.查看所有的服务端口(LISTEN,ESTABLISHED)
netstat -ap
3.查看指定端口,可以结合grep命令
netstat -apn | grep 8080 或 lsof -i:8080
4.查询进程详情
ps -aux | grep pid
5.关闭使用这个端口的程序,使用kill + 对应的pid
kill -9 PID
来源:https://www.cnblogs.com/wucaiyun1/p/11929513.html