Linux批量kill进程

来源:https://blog.csdn.net/u012421852/article/details/51194782

命令:

$ps -ef | grep "StarCraft" | grep -v "grep" | cut -c 9-15 | xargs kill -9

其中:

ps -ef: 静态显示所有进程

grep "StarCraft": 筛选所有含有StarCraft字眼的进程

grep -v "grep": 筛选出所有不含grep字眼的进程

cut -c 9-15: 剪取9-15位的字符,这里对应进程ID,对象为ps -ef输出对象

xargs kill -9: 杀掉前面得到的进程

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.