How to kill all processes matching a name?

后端 未结 11 1517
不思量自难忘°
不思量自难忘° 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:04

    pkill -x matches the process name exactly.

    pkill -x amarok
    

    pkill -f is similar but allows a regular expression pattern.

    Note that pkill with no other parameters (e.g. -x, -f) will allow partial matches on process names. So "pkill amarok" would kill amarok, amarokBanana, bananaamarok, etc.

    I wish -x was the default behavior!

提交回复
热议问题