psとtopはpkillとpgrepとは異なるコマンド名を表示します

psとtopはpkillとpgrepとは異なるコマンド名を表示します

コマンド名が変更されたと思われるプロセスを終了したい場合がよくあります(よく考えたりsetproctitle()、似たようなことをしたり)。

明らかにpkill、、pgrepおよび の仲間は新しいコマンド名を読み取らない (つまり、 プロセスがコマンドの名前を変更しても、pkill はそれをrubyではなくとして認識しますdelayed_job)。

しかしps、そうh?topします。

psこうした種類のプロセスを強制終了するには、grep/awking するしか方法がありませんか、それとも何か見落としているのでしょうか?

答え1

ps -fpgrep -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.

関連情報