LoginSignup
3
3

More than 5 years have passed since last update.

psでCOMMANDに特定のパターンを含むプロセスだけをきれいに出力する

Posted at

grep しちゃうとヘッダ部分が出力されない。

きれいに表示させるなら pgrep -d, -f パターン | xargs -r ps uwp のように pgrepxargs を組み合わせて使う。プロセステーブルを2回スキャンするのが欠点と言えば欠点である。

ps auxww | sed -n '1p; /sed -n /d; /パターン/p' なんて方法もある。

xargs の -r は GNU 拡張なので、汎用性でいうと後のほうかな。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3