Getting pids from ps -ef |grep keyword

后端 未结 6 927
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 07:42

I want to use ps -ef | grep \"keyword\" to determine the pid of a daemon process (there is a unique string in output of ps -ef in it).

I can kill the pr

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 07:57

    To kill a process by a specific keyword you could create an alias in ~/.bashrc (linux) or ~/.bash_profile (mac).

    alias killps="kill -9 `ps -ef | grep '[k]eyword' | awk '{print $2}'`"
    

提交回复
热议问题