linux/windows 下kill某个pid的进程

来源:互联网 发布:js常用正则表达式大全 编辑:程序博客网 时间:2024/06/13 11:57

【linux环境】

方法1:截取进程pid,再kill

ps -ef | grep java.endorsed.dirs | grep -v grep | cut -c10-15 | xargs kill -9

 方法2:

1)找到linux下的进程pids

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

2)循环pids,kill -9 pid

 

【windows】

kill 命令行参数中带tomcat字符串的 java.exe 进程

方法1:

wmic process where (Name="java.exe" AND CommandLine like "%%tomcat%%") call terminate >nul 2>nul

 

方法2:


C:\Users\j00113584>wmic process where name="calc.exe" get Processid
ProcessId
6848


C:\Users\j00113584>taskkill /F /PID 6848
成功: 已终止 PID 为 6848 的进程。