2008年11月27日
psをgrepした結果にgrep自身のプロセスを出力させない
psの結果をgrepした結果にgrep自身のプロセスを出力させない方法。
以下、httpdのプロセスを出力させる場合。
# grepの-vオプションを使う
$ ps aux | egrep 'httpd' | egrep -v 'grep'
# 検索文字列に文字クラスを使用してgrepの結果にかからなくする
# ps aux | egrep '[h]ttpd'
以下、httpdのプロセスを出力させる場合。
# grepの-vオプションを使う
$ ps aux | egrep 'httpd' | egrep -v 'grep'
# 検索文字列に文字クラスを使用してgrepの結果にかからなくする
# ps aux | egrep '[h]ttpd'
ラベル: LINUX
スポンサードリンク