Linux 查看端口占用并杀掉
查看所有网络端口
netstat -an
[root@xxxxx~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:8006 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
查看端口具体被那个进程占用
lsof -i :3690
[root@xxxxxx~]# lsof -i :3690
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
svnserve 8533 root 3u IPv4 42704 0t0 TCP *:svn (LISTEN)
再使用以下命令查看详细信息:
ps -aux | grep 8533
[root@iZbp1g3u73g9nybvafuwc6Z ~]# ps -aux | grep 8533
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 8533 0.0 0.0 156996 888 ? Ss 10:20 0:00 svnserve -d -r /shiyu/
root 8648 0.0 0.0 103256 840 pts/0 S+ 10:31 0:00 grep 8533
最后kill-9 pid
kill -9 8533
————————————————
版权声明:本文为CSDN博主「QC班长」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_35624642/article/details/53992127