shell 批量删除进程脚本

对于进程比较多的情况下,如何批量删除进程呢,这里就用到了shell脚本,
1.首先提取出一个进程号,然后kill -9 进程号,然后写在一个for循环里
2.提取出所有的进程号,然后kill -9 所有的进程号
ps -ef | grep python查询进程
/home/rca/vitrage # ps -ef | grep python
309 root 12:46 python start.py
355 root 0:20 python start.py
356 root 0:59 python start.py
357 root 0:01 python start.py
358 root 0:09 python start.py
359 root 0:19 python start.py
360 root 0:20 python start.py
361 root 0:18 python start.py
371 root 0:10 python start.py
753 root 0:00 [python]
757 root 0:00 grep python
1.kill.sh内容如下
#!/bin/sh
for i in ps -ef |grep python | awk '{print $1}';
do
kill -9 $i;
done
2.kill.sh内容如下
a=ps -ef |grep python | awk '{print $1}'
kill -9 $a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值