Getting pids from ps -ef |grep keyword

后端 未结 6 925
被撕碎了的回忆
被撕碎了的回忆 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 08:17

    Try

    ps -ef | grep "KEYWORD" | awk '{print $2}'

    That command should give you the PID of the processes with KEYWORD in them. In this instance, awk is returning what is in the 2nd column from the output.

提交回复
热议问题