How can I kill a process by name instead of PID?

后端 未结 18 2848
孤独总比滥情好
孤独总比滥情好 2020-11-28 17:10

Sometimes when I try to start Firefox it says \"a Firefox process is already running\". So I have to do this:

jeremy@jeremy-desktop:~$ ps aux | grep firefox
         


        
18条回答
  •  天命终不由人
    2020-11-28 17:42

    Kill all processes having snippet in startup path. You can kill all apps started from some directory by for putting /directory/ as a snippet. This is quite usefull when you start several components for the same application from the same app directory.

    ps ax | grep  | grep -v grep | awk '{print $1}' | xargs kill
    

    * I would preffer pgrep if available

提交回复
热议问题