728x90
🐋 문제
리눅스 기초연습문제이당
find 명령어를 통해서 / 내에서 소유자가 user 인 파일들을 모두 찾아서 자세하게 출력하시오.
- 내 풀이
find ~ -user user -exec ls -l {}\;
- 정답 풀이
find / -user user -ls
🐋 궁금증
find
를 사용할때find
한 값을-exec
를 사용해서 {} 담아서 사용하는걸로 알고 있는데
정답풀이에는 어떻게 바로-ls
를 사용했을까? ( 심지어 ls -l 상세보기로 나옴 )find
에-user
옵션만 가능한걸까?- 해당 내용이
man
어디에 적혀있는가?
👻 정리
-exec
를 생략? 할 수있는 명령어가 몇개 존재한다.-name
도-exec
없이-ls
가 써지길래 신기해 했는데 사실-ls
가 특이한 녀석이였다-exec rm
말고-delete
도 가능
man
페이지 EXPRESSION / Operators 에 적혀있다.
Operators
Operators join together the other items within the expression. They include for ex‐
ample -o (meaning logical OR) and -a (meaning logical AND). Where an operator is
missing, -a is assumed.
The -print action is performed on all files for which the whole expression is true, unless
it contains an action other than -prune or -quit. Actions which inhibit the default -print
are -delete, -exec, -execdir, -ok, -okdir, -fls, -fprint, -fprintf, -ls, -print and -printf.
The -delete action also acts like an option (since it implies -depth).
연산자
연산자는 식 내의 다른 항목을 결합합니다. 그들은 예를 들어 포함합니다
ample -o(논리적 OR을 의미) 및 -a(논리적 AND를 의미). 작업자가 있는 위치
결측값, -a를 가정합니다.
-print 작업은 다음과 같은 경우를 제외하고 전체 식이 참인 모든 파일에 대해 수행됩니다
-prune 또는 -prune 이외의 작업이 포함되어 있습니다. 기본 인쇄를 금지하는 작업
-delete, -exec, -execdir, -ok, -okdir, -fls, -fprint, -fprint, -ls, -print 및 -printf입니다.
-delete 액션은 -depth를 의미하므로 옵션처럼 작동합니다.
'이개외않되 > Linux' 카테고리의 다른 글
"쉘 : /bin/sh ( 쉘 지정에 대한 정리 ) " (0) | 2023.06.07 |
---|---|
"Linux grep *(별표) 기능" 에 대한 정리 (0) | 2023.06.05 |
리눅스 하드링크 심볼릭링크 (0) | 2023.06.02 |
is not in the sudoers file. This incident will be reported. (0) | 2023.06.01 |
WSL ubuntu - `ncal` 명령어를 찾지못하는 에러 (0) | 2023.05.29 |