ps와 top은 pkill과 pgrep이 보는 것과 다른 명령 이름을 표시합니다.

ps와 top은 pkill과 pgrep이 보는 것과 다른 명령 이름을 표시합니다.

종종 명령 이름이 변경된 프로세스를 종료하고 싶을 때가 있습니다(나는 생각한다 setproctitle()또는 비슷한 것).

명백한 pkill, pgrep및 친구들은 새로운 명령 이름을 읽지 않습니다(즉, Ruby 프로세스는 명령 이름을 바꾸지만 pkill은 여전히 ​​그것을 로 보고 ruby아닌 것으로 봅니다 delayed_job).

그러나 그렇게 ps하십시오 h?top.

내 유일한 리조트가 이러한 종류의 프로세스를 죽이기 위해 노력하고 있습니까? ps아니면 뭔가 빠졌습니까?

답변1

ps -f, pgrep -f및 을 사용해 보십시오 pkill -f.

해당 매뉴얼 페이지에서:

ps -f

Do full-format listing. This option can be combined with many
other UNIX-style options to add additional columns. It also
causes the command arguments to be printed.

-

pgrep/pkill -f, --full

The pattern is normally only matched against the process name.
When -f is set, the full command line is used.

관련 정보