PS 보조 | grep 구성 대 ps aux | grep "confi[g]"

PS 보조 | grep 구성 대 ps aux | grep "confi[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]"명령이 다음을 검색하기 때문에"구성"문자열이고 두 번째 경우에는 grep "confi[g]"명령에"구성"끈. 그것은 다음을 포함합니다"구성[g]"끈.

출력 에서 검색할 때 grep 명령 프로세스를 인쇄하지 않기 위해 일반적으로 사용되는 grep 트릭입니다 ps.

관련 정보