一条命令根据端口杀死进程windows和linux
windows
netstat -ano | grep 8080
taskkill /pid 1032 -f
或者(批量杀死,主要是findstr,先查找,可以先 netstat -ano 看一下)
netstat -ano | findstr /c:"0.0.0.0:80 "|awk -F" " '{print $5}'|xargs taskkill -f -PID
80后面有空格
/c:后面没有空格
findstr是根据正则表达式查找,需要查找包含空格的文字,否则容易查询8001这种两个的端口
linux
ps -ef | grep 【pidname】 | grep -v grep | awk '{print $2}' | xargs kill -9
或者
pkill -9 redis
参考博客:
findstr https://blog.csdn.net/playboy1/article/details/6869384
netstat windows下杀死进程 https://jingyan.baidu.com/article/7f41ecec496df8593d095cf3.html
还没有评论,来说两句吧...