ps -ef|grep hold.sh |grep -v grep | awk '{print $1}' | xargs kill -9
说明:
ps -ef|grep hold.sh 找到hold.sh进程
|grep -v grep 排除含grep
| awk '{print $1}' 提取第一列 进程号pid
| xargs kill -9 把前面的参数都传递给后面的命令 kill -9 强制杀掉,相当于kill -9 13580
ps -ef|grep hold.sh |grep -v grep | awk '{print $1}' | xargs kill -9
说明:
ps -ef|grep hold.sh 找到hold.sh进程
|grep -v grep 排除含grep
| awk '{print $1}' 提取第一列 进程号pid
| xargs kill -9 把前面的参数都传递给后面的命令 kill -9 强制杀掉,相当于kill -9 13580