当前位置:网站首页>You want to kill a port process, but you can't find it in the service list. You can find this process and kill it through the command line to reduce restarting the computer and find the root cause of

You want to kill a port process, but you can't find it in the service list. You can find this process and kill it through the command line to reduce restarting the computer and find the root cause of

2022-07-07 20:21:00 Mom, I want to eat roasted sweet potato

One 、windows Kill port process steps

1. View port processes

netstat -ano | find " port "

2. Find the application occupied by the port process

tasklist | find " Process number (pid)"

3. Kill port process

taskkill /pid  Process number  -t -f

Tips :find " Process number " Equate to findstr Process number ; The process number is PID Number , See the figure below for details

Two 、Linux Kill port process steps

1.linux Find occupied ports

netstat -tln | grep  Port number 

netstat -tln View port usage , and netstat -tln | grep Port number   Only check the usage of the port number

2.linux Find the application occupied by the port process

lsof -i: Port number 

3.linux Kill port process

kill -9 PID

3、 ... and 、 Combine commands with pipe symbols

1. kill 8080 Port process

netstat -nlp |grep :8080 |grep -v grep|awk '{print $7}' |awk -F '/' '{print $1}' |xargs kill -9

2. The query contains tomcat The process number of

ps -ef|grep tomcat|grep -v grep|awk '{print $2}'

3. Kill all that contain ‘tomcat’ The process of

ps -ef|grep tomcat|grep -v grep|awk '{print $2}' |xargs kill -9
原网站

版权声明
本文为[Mom, I want to eat roasted sweet potato]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071817275856.html