FIND(1) General Commands Manual FIND(1) find -- find [-H] [-L] [-P] [-D _] [-O] [_...] [] GNU find. GNU find , (. ), ( , ), , find . , <<.>>. find , (, , ), << >> findutils, Finding Files findutils. , , , , . -H, -L -P . , , , <<->>, <<(>> <>. , , . , . , -print (, , -print0). <<>> . find, . ' <<>> -H, -L, -P, -D -O , . , --, , , , , , find : , ( <<->>). , <<->>, find . , , , , - , <<./>> , <>. , , , GNU -files0-from, find. -P . . find , , . -L . find , , , ( find , ). -noleaf. -P, -noleaf . -L, find , , . -L, -type , , ( ). , find (, -delete), . -L , -lname -ilname . -H , . find , . , . , (, ). , , . -H, , , (, , -maxdepth 0 ). -H, -L -P, ; . , , -P, -H -L. GNU find , , . . , , , , . , , , . , -P ( -H, -L), . , , . find (, , ) . -H -L , - -newer , , . -newerXY, -anewer -cnewer. -follow , -L, , (, -L, -follow , - , -follow , , - ). -D debugopts ; , find , . . findutils . find -D help. : exec -exec, -execdir, -ok -okdir opt , ' ; . -O. rates , , . search . stat stat lstat. find . tree . all ( help). help . -Olevel . find , , ; . , . 0 1. 1 . , , (, -name -regex) . 2 - -type -xtype , , , inode. Unix, , readdir(), , , , . -fstype , ( `/etc/mtab') find, -false. 3 . , ( ) , , . , . -o , , -a , , , . , . (, , -type f , -type c). , . find, . , , , . , ( 1) 4.3.x. findutils find . . , , , . : , , . , -empty , . ( ) , , . , -print . , - . . , -depth find . , . . , -regextype , , . . -o ( ) -a ( ). , , -a. -print , , , -prune -quit. , -print: -delete, -exec, -execdir, -ok, -okdir, -fls, -fprint, -fprintf, -ls, -print -printf. -delete ( -depth). . , . -daystart ( -amin, -atime, -cmin, -ctime, -mmin -mtime) , 24 . , . -follow ; -L. . -noleaf. -follow , . -H -L, -follow -newer; - -newer , . -newerXY, -anewer -cnewer. , -type , , . -follow -lname -ilname - . -regextype , -regex -iregex, . , -regextype help. Texinfo (. . ) . -warn, -nowarn . , , find . -warn, , -nowarn . , ' , find . POSIXLY_CORRECT -warn, , , . . , . , , , . , find , . , , , , -L. -d -depth, FreeBSD, NetBSD, MacOS X OpenBSD. -depth . -delete -depth. -files0-from , . , , , , , find . , . '. -files0-from - , , . -ok -okdir, , , . NUL ASCII. NUL, . . , find . , find , . , . , find , . , -maxdepth 0. : , , , . find , . , find -quit , . <<>> , , , , findutils. -help, --help find . -ignore_readdir_race , find , . , , find , , , . , . , , -- ( , find: , -- ). , find -ignore_readdir_race -delete, : , -delete . -maxdepth , (' ) . -maxdepth 0, . -mindepth , (' ). -mindepth 1, , . -mount . -xdev, find. -noignore_readdir_race -ignore_readdir_race. -noleaf , 2 , . , Unix, CD-ROM MS-DOS AFS. Unix 2 : <<.>>. , ( ) <<..>>, ' . find , , 2 , , (-<<>> ). , , . -version, --version find . -xdev . , -newerXY -samefile, , . -H, -L -P - -follow, , . (, stat(2) ), , find . n (, -amin, -mtime, -gid, -inum, -links, -size, -uid -used) +n , n, -n , n, n , n. : -amin n , n . -anewer . -H -L, , . -atime n , n*24 . find 24 , , -atime +1, , . -cmin n , n . -cnewer . -H -L, , . -ctime n , n*24 . . -atime, , . -empty , . -executable , , , ( ), . (ACL) , ' , -perm. access(2), NFS, ' UID ( root-), access(2) , , ' UID, . access(2), , , , . -false . -fstype . Unix; , Unix: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. -printf %F, . -gid n , n. -group ( ). -ilname , -lname, . -L -follow, , . -iname -name, . , <> <> <>, <>, <>, <> . , <<*foo*>> <<.foobar>>. -inum n inode, , n. , -samefile. -ipath -path, . -iregex -regex, . -iwholename . -ipath. -ipath. -links n , n. -lname , . <> <<.>>. -L -follow, , . -mmin n , n . -mtime n , n*24 . . -atime, , . -name (, ) . , , -name, , <<-name a/b>> (, -path ). , , POSIXLY_CORRECT. (<<*>>, <> <<[]>>) <<.>> ( findutils-4.2.2; . ). , -prune, ; . . , , Bash, . fnmatch(3). , . -newer . -H -L, , . -newerXY , X Y . X Y - : a B c inode m t . , X t. . , B. XY, . -d GNU date. , , . , , , . -nogroup , . -nouser , . -path . <> <<.>>. , , find . -path "./sr*sc" ./src/misc ( ). , -prune . , , . , . , : find -path ///_ -print Find -path ' . ' , -path, , (, , , ). -path find HP-UX, POSIX 2008. -perm ( ). . , , , . , <<-perm g=w>> , 0020 ( , ). , <> <<->>, <<-perm -g=w>>, - . . , . -perm - . , , . <>, <> <>, . . , . -perm / . . <>, <> <>, . . , . , - ( , -perm -000). -perm + ( 2005 ). -perm /. -readable , . (ACL) , -perm. access(2), NFS, ' UID ( root-), access(2) , , ' UID, . -regex . , . , ./fubar3, <<.*bar.>> <<.*b.*3>>, <>. , , find, Emacs ( , <<.>> ), -regextype. -samefile inode, . -L, . -size n[cwbkMG] , n ' , . : `b' 512- ( , ) `c' `w' `k' (, 1024 ) `M' (, 1024 * 1024 = 1048576 ) `G' (, 1024 * 1024 * 1024 = 1073741824 ) st_size stat, lstat ( stat), , . , , ls -l. ', <<%k>> <<%b>> -printf . <> 512- , -- 1024- , -ls. + - <<>> <<>>, ; n . ', . -size -1M , -size -1048576c. , -- , 0 1048575 . -true . -type c c: b () c () d p (FIFO) f l ; , -L -follow, . -L, -xtype. s D (Solaris) , , <<,>> ( GNU). -uid n , n. -used n , n . -user ' ' ( ). -wholename -path. -path. -writable , . (ACL) , -perm. access(2), NFS, ' UID ( root-), access(2) , , ' UID, . -xtype c , -type, . : -H -P, , c; -L, , c <>. , -xtype , -type. -context ( SELinux) . -delete . , , , find ( ). : ', find , , -delete, find , . -delete -depth. -depth -prune, -delete -prune. find -print, -delete . , , ', -depth . -delete , . -ignore_readdir_race, find -delete, : , , -delete . -exec ; ; , 0. find , , <<;>>. <<{}>> , , , , find. ( <<\>>) . -exec . . . -exec ' , . , -execdir. -exec {} + -exec , ; . , , , xargs. <<{}>>, , <<+>>; ( <<\>>) . . <<+>> , , find . find , , . , -exec ... {} + -quit . -exec . -execdir ; -execdir {} + -exec, , . , , find. , -exec, {} , find . , . -exec, <<+>> -execdir , - . , , PATH <<.>>. , - , , -execdir. PATH, . - <<+>> , find . find , , . , , + ;; -execdir {} + , -execdir {} ; , 0. -fls ; -ls, , -fprint. , . . , , . -fprint ; . find, ; , . /dev/stdout /dev/stderr ; , . , . . , , . -fprint0 ; -print0, , -fprint. , . . , , . -fprintf ; -printf, , -fprint. , . . , , . -ls ; ls -dils , . 1 , POSIXLY_CORRECT. 512- . . , , . -ok ; -exec, . , . , . , /dev/null. -files0-from. , . , POSIXLY_CORRECT, , , find. , find. LC_CTYPE ( ) LC_COLLATE ( ). -okdir ; -execdir, , -ok. , . , /dev/null. -files0-from. -print ; . find , , , , , -print0 -print. . , , . -print0 ; - ( , -print). , , , find . -0 xargs. -printf ; <<\>> <<%>>. C printf(3). , , %s, %d, , , . , <<->> ( ). -print, -printf . : \a . \b Backspace. \c . \f . \n . \r . \t . \v . \0 NUL ASCII. \\ (<<\>>). \NNN , ASCII NNN ( ). <<\>>, - , . %% . %a , C ctime(3). %Ak , k, <<@>>, C strftime(3). k. , strftime(3), . strftime(3). @ 1 1970 , 00:00 GMT, . : H (00..23) I (01..12) k ( 0..23) l ( 1..12) M (00..59) p AM ( ) PM ( ) r , 12- (:: [AP]M) S (00.00 .. 61.00). . T , 24- (::.xxxxxxxxxx) + , <<+>>, : <<2004-04-28+22:22:05.0>>. GNU. ( TZ). . X (::). . Z (, EDT) , : a (..) A , (..) b (..) B , (..) c (Sat Nov 04 12:02:33 EST 1989). , ctime(3), , . d (01..31) D (//) F (--) h , b j (001..366) m (01..12) U , (00..53) w (0..6) W , (00..53) x (//) y (00..99) Y (1970...) %b , , 512- . , , , , %s/512, , . %Bk , , k, , %A. , . %c , C ctime(3). %Ck , k, , %A. %d ; 0 , . %D , ( st_dev ), . %f ; ( ). / <>. . %F , ; -fstype. %g , , . %G . %h ; ( , ). ( ) %h <<.>>. , ( /), %h . . %H , %i inode ( ). %k , , 1 . , , , , %s/1024, , . %l ' ( , ). %m ( ). <<>> , , , , %m. , , # ( , , <<%#m>>). %M ( , ls). findutils 4.2.5 . %n . %p . %P , . %s . %S . (_*st_blocks / st_size). . , , 1.0, , , , 1.0. , , , . _ , , , 512 . , . , st_blocks, , 1.0. %t , C ctime(3). %Tk , k, , %A. %u ' - , . %U . %y ( ls -l), U= (, , ) %Y ( %y) : <>=, <>= , <> - . %Z ( SELinux) . %{ %[ %( . <<%>>, - , , (, , ). <<%>> , . %m %d #, 0 +, , . , G, U, b, D, k n. <<->>. ( ) . . , , . -prune ; , . -depth, -prune . -delete -depth, -prune -delete. , src/emacs , , : find . -path ./src/emacs -prune -o -print -quit ( , ). -prune, -prune , -quit find. . , -exec ... + -execdir ... +. -quit , . , find /tmp/ /tmp/ -print -quit <>>. -quit , , . , , : find / -name -print -quit : ( ) . , , , . : <<\(...\)>> <<(...)>>. ! , . , , . -not , ! , POSIX. 1 2 ' -a; 2, 1 . -a 2 , 1 2. -and 2 , 1 2, POSIX. 1 -o 2 ; 2, 1 . 1 -or 2 , 1 -o 2, POSIX. 1 , 2 ; 1 2. 1 ; 2. <<>> , . -fprintf. , , -a, (, , ) , -o. , find . -name -o -name -print . find , . , , . , - , <<\0>> <>. (, ). -, . -print0, -fprint0 , , . -ls, -fls . , C (, <<\f>>, <<\">>). . ( -ls -fls 041 0176) . -printf, -fprintf , . , , . %D, %F, %g, %G, %H, %Y %y , . %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u %U , , , . %f, %h, %l, %p %P . , GNU ls. , -ls -fls. , find, , <<\0>> , . , , LC_CTYPE. -print, -fprint , -printf -fprintf. find , , -print0 -print. -ok -okdir . . POSIX POSIXLY_CORRECT. POSIX (IEEE Std 1003.1-2008, 2016 ) : -H . -L . -name , POSIX POSIX fnmatch(3). findutils-4.2.2, ( <<*>>, <> <<[]>>) <<.>>, IEEE PASC 126. findutils. -type . POSIX <>, <>, <>, <>, <

>, <> <>. GNU find <>, Door (), , . , GNU find . -ok . <> <>, LC_MESSAGES. POSIXLY_CORRECT, (yes) (no) . . nl_langinfo(3), YESEXPR NOEXPR. POSIXLY_CORRECT , find. -newer . , . , ; . . -perm . POSIXLY_CORRECT , ( +a+x), POSIX, . -atime, -ctime, -depth, -exec, -group, -links, -mtime, -nogroup, -nouser, -ok, -path, -print, -prune, -size, -user -xdev. POSIX <<(>>, <<)>>, <> / -a -o. , , POSIX. , GNU find. POSIX find: find ; , . find , . GNU find . , , , . , GNU find , . find , . , . -noleaf, , , . , , -L -follow, , find . , , , find , stat() chdir() , . -d BSD, POSIX -depth. POSIXLY_CORRECT -regex -iregex, POSIX. LANG , . LC_ALL , . LC_COLLATE POSIX , , -name GNU find fnmatch(3), , LC_COLLATE . -ok; LC_MESSAGES , -ok, - LC_COLLATE. LC_CTYPE , , -name, fnmatch(3). - , , -ok. LC_CTYPE , ; . << >>. LC_MESSAGES , . POSIXLY_CORRECT, , -ok. NLSPATH . PATH , , -exec, -execdir, -ok -okdir. POSIXLY_CORRECT , -ls -fls. POSIXLY_CORRECT, 512 . , 1024 . (, -nowarn), POSIX , , -ok, , stderr, . POSIXLY_CORRECT , -perm +zzz -perm /zzz, +zzz . POSIXLY_CORRECT , . POSIXLY_CORRECT, , -ok, , find. TZ ' -printf -fprintf. <> o core /tmp . $ find /tmp -name core -type f -print | xargs /bin/rm -f , , - , , . <> o core /tmp , , , , , . $ find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f -name -type, stat(2) . , , find , , , , xargs. o proggy NUL- : $ proggy | find -files0-from - -maxdepth 0 -type f -empty `-files0-from -` << , ; -maxdepth 0 , , ( ). o . $ find . -type f -exec '{}' \; , , . , . `-exec ... +` `-execdir ... +` . o , set-user-ID /root/suid.txt, -- /root/big.txt. $ find / \ \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \) , \ \( -size +100M -fprintf /root/big.txt '%-10s %p\n' \) '\' . , . o , . $ find $HOME -mtime 0 , 24 , . , -mtime 0, , 24 . o , , . $ find /sbin /usr/sbin -executable \! -readable -print o , , , . $ find . -perm 664 , , (, ), . o , , , (, ). $ find . -perm -664 , , 0777. o , (, ). $ find . -perm /222 o , . $ find . -perm /220 $ find . -perm /u+w,g+w $ find . -perm /u=w,g=w , , . , ', ; , . o , . $ find . -perm -220 $ find . -perm -g+w,u+w . o . $ find . -perm -444 -perm /222 \! -perm /111 $ find . -perm -a+r -perm /a+w \! -perm /a+x , (-perm -444 -perm -a+r), (-perm /222 -perm /a+w), (! -perm /111 ! -perm /a+x, ). -- o /source-dir /dest-dir, .snapshot ( , ). , <<~>>, . $ cd /source-dir $ find . -name .snapshot -prune -o \( \! -name '*~' -print0 \) \ | cpio -pmd0 /dest-dir -prune -o \( ... -print0 \) . , -prune , . , -prune , -o , ( , , ). -o . , -print0 , -prune. <<>> -o, , , . o ' : $ find repo/ \ \( -exec test -d '{}/.svn' \; \ -or -exec test -d '{}/.git' \; \ -or -exec test -d '{}/CVS' \; \ \) -print -prune : repo/project1/CVS repo/gnu/project2/.svn repo/gnu/project3/.svn repo/gnu/project3/src/.svn repo/project4/.git -prune , (, project3/src, project3/.svn), (project2 project3). o . $ find /tmp -type f,d,l , /tmp, ( GNU). , : $ find /tmp \( -type f -o -type d -o -type l \) o . $ find / -name -print -quit o %f %h -printf . . $ find . .. / /tmp /tmp/TRACE compile compile/64/tests/find -maxdepth 0 -printf '[%h][%f]\n' [.][.] [.][..] [][/] [][tmp] [/tmp][TRACE] [.][compile] [compile/64/tests][find] find 0, , , . , , find . , find . , -exec ... {} + -execdir ... {} +. findutils-4.2.2, ( <<*>>, <> <<[]>>), , <<.>>, IEEE POSIX 126. findutils-4.3.3, -perm /000 , . findutils-4.3.3. findutils-4.3.11, -delete find, . , find . find -delete . -files0-from 4.9.0 -newerXY 4.3.3 BSD -D 4.3.1 -O 4.3.1 -readable 4.3.0 -writable 4.3.0 -executable 4.3.0 -regextype 4.2.24 -exec ... + 4.2.12 POSIX -execdir 4.2.12 BSD -okdir 4.2.12 -samefile 4.2.11 -H 4.2.5 POSIX -L 4.2.5 POSIX -P 4.2.5 BSD -delete 4.2.3 -quit 4.2.3 -d 4.2.3 BSD -wholename 4.2.0 -iwholename 4.2.0 -ignore_readdir_race 4.2.0 -fls 4.0 -ilname 3.8 -iname 3.8 -ipath 3.8 -iregex 3.8 -perm + findutils-4.5.12. -perm /. + findutils-4.2.21, 2005 . - find . -name -o -name -print , , , find . -name -o \( -name -a -print \). ', -a -o, , , -a. " " $ find . -name *.c -print find: find: <<-name>>? , *.c , , find : find . -name frcode.c locate.c word_io.c -print , , , -name , . , -, , find - , : $ find . -name '*.c' -print $ find . -name \*.c -print , ' , find POSIX. . , -exec. -execdir. LC_COLLATE -ok. GNU findutils: - - GNU Savannah: GNU findutils bug-findutils: (C) 1990-2022 Free Software Foundation, Inc. GPLv3+: GNU GPL 3 . : . , , . . chmod(1), locate(1), ls(1), updatedb(1), xargs(1), lstat(2), stat(2), ctime(3) fnmatch(3), printf(3), strftime(3), locatedb(5), regex(7) : : info find Andriy Rysin Yuri Chornoivan ; , GNU General Public License Version 3 . . , , : . FIND(1)