追伸 | grep config と ps aux | grep "config[g]"

追伸 | grep config と ps aux | grep "config[g]"

出力にコマンドps aux | grepが含まれているのに含まれない理由を知りたいです。grepps aux | grep "confi[g]"

$ ps aux | grep config
root               50   0.0  0.0  2548368   5760   ??  Ss   14Sep16   0:29.27 /usr/libexec/configd
emesa           20534   0.0  0.0  2434840    796 s002  S+    4:41PM   0:00.00 grep config

$ ps aux | grep "confi[g]"
root            15776   0.0  0.0  2519824    940   ??  Ss   Tue11AM   0:00.08 /System/Library/PrivateFrameworks/SystemAdministration.framework/XPCServices/writeconfig.xpc/Contents/MacOS/writeconfig
root               50   0.0  0.0  2547320   5740   ??  Ss   14Sep16   0:29.27 /usr/libexec/configd

答え1

grep "confi[g]"コマンドは「設定」文字列と2番目のケースではgrep "confi[g]"コマンドに「設定」文字列。「設定」弦。

psこれは、出力で検索するときに grep コマンドのプロセスが印刷されないようにするためによく使用される grep トリックです。

関連情報