How to kill all processes matching a name?

后端 未结 11 1530
不思量自难忘°
不思量自难忘° 2020-11-29 14:53

Say I want to kill every process containing the word amarok. I can print out the commands I want to execute. But how do I actually make the shell execute them. ie.



        
11条回答
  •  佛祖请我去吃肉
    2020-11-29 15:10

    If you're using cygwin or some minimal shell that lacks killall you can just use this script:

    killall.sh - Kill by process name.

    #/bin/bash
    ps -W | grep "$1" | awk '{print $1}' | xargs kill --
    

    Usage:

    $ killall 
    

提交回复
热议问题