![補助grep config対ps aux | grep config 対 grep "conf[g]"](https://linux33.com/image/95511/%E8%A3%9C%E5%8A%A9grep%20config%E5%AF%BEps%20aux%20%7C%20grep%20config%20%E5%AF%BE%20grep%20%22conf%5Bg%5D%22.png)
コマンドが出力に含まれているがps aux | grep
含まれていない理由は疑問に思います。grep
ps 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]"
コマンドに含まれません。「構成」ひも。それは含んでいる「構成[g]」ひも。
ps
これは、出力での検索中にgrepコマンドプロセスを印刷しないための一般的なgrepトリックです。