본문 바로가기
Linux/Shell

find 명령어 옵션

by Sondho 2020. 11. 19.
-E -regex, -iregex 프라이머리 뒤에 오는 정규식을 기본 정규식(BRE)이 아닌 확장(현대식) 정규식으로 해석한다.  re_format(7) 설명서 페이지에는 두 가지 형식이 모두 설명되어 있다.
-H 명령줄에 지정된 각 심볼릭 링크에 대해 반환된 파일 정보 및 파일 유형(stat(2) 참조)을 링크가 아닌 링크에서 참조하는 파일의 정보로 설정하십시오.  참조된 파일이 존재하지 않는 경우, 파일 정보와 유형은 링크 자체에 대한 것이 된다.  명령줄에 없는 모든 심볼릭 링크의 파일 정보는 링크 자체의 것이다.
-L

각 심볼릭 링크에 대해 반환된 파일 정보 및 파일 유형(stat(2) 참조)을 링크가 아닌 링크에서 참조한 파일의 정보로 한다.  참조된 파일이 존재하지 않는 경우, 파일 정보와 유형은 링크 자체에 대한 것이 된다.

이 옵션은 사용되지 않는 추종 기본 옵션과 동일하다.

-P 각 심볼릭 링크에 대해 반환된 파일 정보 및 파일 유형(통계(2) 참조)을 링크 자체의 정보로 한다.  이것이 디폴트다.
-X xargs(1)와 함께 안전하게 사용할 수 있도록 허용한다.  파일 이름에 xargs(1)에서 사용하는 구분 문자가 포함된 경우 표준 오류에 진단 메시지가 표시되고 파일은 생략된다.  구분 문자로는 싱글('' '')과 더블('''') 인용문, 백슬래시('\'), 스페이스, 탭, 뉴라인 문자가 있다.
그러나 효과적인 대안으로 "xargs 0"과 연계한 -print0 예비선거를 고려할 수도 있다.
-d 깊이 첫 번째 통과를 수행하기 위한 원인 찾기. 즉, 디렉토리는 사후 순서로 방문되고 디렉토리의 모든 항목은 디렉토리 자체보다 먼저 수행된다.
기본적으로 사전 주문(즉, 컨텐츠 앞에 있는 방문 디렉토리를 찾으십시오.  참고로 기본값은 너비 우선 통과가 아니다.

이 옵션은 IEEE 규격 1003.1-2001('"POSIX.1")의 심층 주기와 같다.  -d 옵션은 찾기를 cpio(1)와 함께 사용하여 비정상적인 권한을 가진 디렉토리에 포함된 파일을 처리할 때 유용할 수 있다.  디렉터리에 파일을 배치하는 동안 쓰기 권한이 있는지 확인한 다음 디렉터리의 권한을 마지막으로 설정하십시오.
-f 이동할 찾기에 대한 파일 계층을 지정하십시오.  파일 계층 구조는 옵션 직후 피연산자로 지정할 수도 있다.
-s 찾기가 각 디렉터리 내의 사전순으로 파일 계층 구조를 통과하도록 하십시오.  참고: 'find -s'와 'find | sort'는 다른 결과를 줄 수 있다.
-x 찾기가 다운로드가 시작된 파일의 그것과 다른 장치 번호를 가진 디렉토리로 내려가는 것을 방지한다.
이 옵션은 사용되지 않는 -xdev 기본 옵션과 동일하다.

-E Interpret regular expressions followed by -regex and -iregex primaries as extended (modern) regular expressions rather than basic regular expressions (BRE's).  The re_format(7) manual page fully describes both formats.
-H Cause the file information and file type (see stat(2)) returned for each symbolic link specified on the command line to be those of the file referenced by the link, not the link itself.  If the referenced file does not exist, the file information and type will be for the link itself.  File information of all symbolic links not on the command line is that of the link itself.
-L Cause the file information and file type (see stat(2)) returned for each symbolic link to be those of the file referenced by the link, not the link itself.  If the referenced file does not exist, the file information and type will be for the link itself.

This option is equivalent to the deprecated -follow primary.
-P Cause the file information and file type (see stat(2)) returned for each symbolic link to be those of the link itself.  This is the default.
-X Permit find to be safely used in conjunction with xargs(1).  If a file name contains any of the delimiting characters used by xargs(1), a diagnostic message is displayed on standard error, and the file is skipped.  The delimiting characters include single (`` ' '') and double (`` " '') quotes, backslash (``\''), space, tab and newline characters.

However, you may wish to consider the -print0 primary in conjunction with ``xargs -0'' as an effective alternative.
-d Cause find to perform a depth-first traversal, i.e., directories are visited in post-order and all entries in a directory will be acted on before the directory itself. By default, find visits directories in pre-order, i.e., before their contents.  Note, the default is not a breadth-first traversal.

This option is equivalent to the -depth primary of IEEE Std 1003.1-2001 (``POSIX.1'').  The -d option can be useful when find is used with cpio(1) to process files that are contained in directories with unusual permissions.  It ensures that you have write permission while you are placing files in a directory, then sets the directory's permissions as the last thing.
-f Specify a file hierarchy for find to traverse.  File hierarchies may also be specified as the operands immediately following the options.
-s Cause find to traverse the file hierarchies in lexicographical order, i.e., alphabetical order within each directory.  Note: `find -s' and `find | sort' may give different results.
-x Prevent find from descending into directories that have a device number different than that of the file from which the descent began.

This option is equivalent to the deprecated -xdev primary.

 

'Linux > Shell' 카테고리의 다른 글

group 명령어  (0) 2020.11.19
id 명령어 옵션  (0) 2020.11.19
ls 명령어 옵션  (0) 2020.11.19
zip, unzip 명령어  (0) 2020.08.07
alias로 단축명령어 생성  (0) 2020.07.14

댓글