Enable checking of support for --version and --help
[findutils.git] / find / find.1
blobb7a49bf76e37aa7f6d8e54f9f9de870da01a8a90
1 .TH FIND 1 \" -*- nroff -*-
2 .SH NAME
3 find \- search for files in a directory hierarchy
4 .SH SYNOPSIS
5 .B find 
6 [-H] [-L] [-P] [path...] [expression]
7 .SH DESCRIPTION
8 This manual page
9 documents the GNU version of
10 .BR find .
11 GNU
12 .B find
13 searches the directory tree rooted at each given file name by
14 evaluating the given expression from left to right, according to the
15 rules of precedence (see section OPERATORS), until the outcome is
16 known (the left hand side is false for \fIand\fR operations, true for
17 \fIor\fR), at which point
18 .B find
19 moves on to the next file name.
20 .PP
21 The `-H', `-L' and `-P' options control the treatment of symbolic
22 links.  Command-line arguments following these are taken to be names
23 of files or directories to be examined, up to the first argument that
24 begins with `\-', `(', `)', `,', or `!'.  That argument and any
25 following arguments are taken to be the expression describing what is
26 to be searched for.  If no paths are given, the current directory is
27 used.  If no expression is given, the expression `\-print' is used
28 (but you should probably consider using `\-print0' instead, anyway).
29 .PP
30 This manual page talks about `options' within the expression list.
31 These options control the behaviour of 
32 .B find
33 but are specified immediately after the last path name.  The two
34 `real' options `-H', `-L' and `-P' must appear before the first path
35 name, if at all.
36 .SH OPTIONS
37 .IP \-P
38 Never follow symbolic links.  This is the default behaviour.  When 
39 .B find
40 examines or prints information a file, and the file is a symbolic
41 link, the information used shall be taken from the properties of the
42 symbolic link itself.  
44 .IP \-L
45 Follow symbolic links.  When 
46 .B find
47 examines or prints information about files, the information used shall
48 be taken from the properties of the file to which the link points, not
49 from the link itself (unless it is a broken symbolic link or 
50 .B find
51 is unable to examine the file to which the link points).  Use of this
52 option implies \-noleaf.  If you later use the \-P option, \-noleaf
53 will still be in effect.
55 .IP \-H
56 Do not follow symbolic links, except those appearing on the command
57 line.  When
58 .B find
59 examines or prints information about files, the information used 
60 shall be taken from the properties of the symbolic link itself.   The
61 only exception to this behaviour is when a file specified on the
62 command line is a symbolic link, and the link can be resolved.  For
63 that situation, the information used is taken from whatever the link
64 points to (that is, the link is followed).  The information about the
65 link itself is used as a fallback if the file pointed to by the
66 symbolic link cannot be examined.
68 When the \-H option is in effect, the \-type predicate will always
69 match against the type of the file that a symbolic link points to
70 rather than the link itself (unless the symbolic link is broken).
71 Using \-H causes the \-lname and \-ilname predicates always to return
72 false.
74 If more than one of \-H, \-L and -P are both specified, each overrides
75 the others; the last one appearing on the command line takes effect.
76 Since it is the default, the \-P option should be considered to be in
77 effect unless either \-H or \-L is specified.
79 GNU 
80 .B find
81 frequently stats files during the processing of the command line
82 itself, before any searching has begun.  These options also affect how
83 those arguments are processed.  Specifically, there are a number of
84 tests that compare files listed on the command line against a file we
85 are currently considering.  In each case, the file specified on the
86 command line will have been examined and some of its properties will
87 have been saved.  If the named file is in fact a symbolic link, and
88 the \-P option is in effect (or if neither \-H nor \-L were
89 specified), the information used for the comparison will be taken from
90 the properties of the symbolic link.  Otherwise, it will be taken from
91 the properties of the file the link points to.  If
92 .B find 
93 cannot follow the link (for example because it has insufficient
94 privileges or the link points to a nonexistent file) the properties of
95 the link itself will be used.
97 When the \-H or \-L options are in effect, any symbolic links listed
98 as the argument of \-newer will be dereferenced, and the timestamp
99 will be taken from the file to which the symbolic link points.  The
100 same consideration applies to \-anewer and \-cnewer.
102 Similarly, when \-H or \-L is in effect, the \-type predicate will
103 always match against the type of the file that a symbolic link points
104 to rather than the link itself (unless the link is broken or cannot be
105 dereferenced).  Using \-H or \-L causes the \-lname and \-ilname
106 predicates always to return false (again, except in the case of broken
107 links).
109 The \-follow option has a similar effect to \-L, though it takes
110 effect at the point where it appears (that is, if \-L is not used but
111 \-follow is, any symbolic links appearing after it on the command line
112 will be dereferenced).
115 .SH EXPRESSIONS
116 The expression is made up of options (which affect overall operation
117 rather than the processing of a specific file, and always return true),
118 tests (which return a true or false value), and actions (which have side
119 effects and return a true or false value), all separated by operators.
120 \-and is assumed where the operator is omitted.  If the expression contains
121 no actions other than \-prune, \-print is performed on all files
122 for which the expression is true.
123 .SS OPTIONS
125 All options always return true.  Except for \-follow and \-daystart,
126 they always take effect, rather than being processed only when their
127 place in the expression is reached.  Therefore, for clarity, it is
128 best to place them at the beginning of the expression.  A warning is
129 issued if you don't do this.
130 .IP \-daystart
131 Measure times (for \-amin, \-atime, \-cmin, \-ctime, \-mmin, and \-mtime)
132 from the beginning of today rather than from 24 hours ago.  This
133 option only affects tests which appear later on the command line.
134 .IP \-depth
135 Process each directory's contents before the directory itself.
136 .IP \-d
137 A synonym for \-depth, for compatibility with FreeBSD, NetBSD, MacOS X and OpenBSD.
138 .IP \-follow
139 Deprecated; use the \-L option instead.  Dereference symbolic links.
140 Implies \-noleaf.  Unless the \-H or \-L option has been specified,
141 the position of the \-follow option changes the behaviour of the
142 \-newer predicate; any files listed as the argument of \-newer will be
143 dereferenced if they are symbolic links.  The same consideration
144 applies to \-anewer and \-cnewer.  Similarly, the \-type predicate
145 will always match against the type of the file that a symbolic link
146 points to rather than the link itself.  Using \-follow causes the
147 \-lname and \-ilname predicates always to return false.
148 .IP "\-help, \-\-help"
149 Print a summary of the command-line usage of
150 .B find
151 and exit.
152 .IP \-ignore_readdir_race
153 Normally, \fBfind\fR will emit an error message when it fails to stat a file.
154 If you give this option and a file is deleted between the time \fBfind\fR 
155 reads the name of the file from the directory and the time it tries to stat 
156 the file, nno error message will be issued.    This also applies to files
157 or directories whose names are given on the command line.  This option takes
158 effect at the time the command line is read, which means that you cannot search
159 one part of the filesystem with this option on and part of it with this option
160 off (if you need to do that, you will need to issue two \fBfind\fR commands
161 instead, one with the option and one without it).
162 .IP "\-maxdepth \fIlevels\fR"
163 Descend at most \fIlevels\fR (a non-negative integer) levels of
164 directories below the command line arguments.  `\-maxdepth 0' means
165 only apply the tests and actions to the command line arguments.
166 .IP "\-mindepth \fIlevels\fR"
167 Do not apply any tests or actions at levels less than \fIlevels\fR (a
168 non-negative integer).  `\-mindepth 1' means process all files except
169 the command line arguments.
170 .IP \-mount
171 Don't descend directories on other filesystems.  An alternate name for
172 \-xdev, for compatibility with some other versions of
173 .BR find .
174 .IP \-noignore_readdir_race
175 Turns off the effect of \-ignore_readdir_race. 
176 .IP "\-noleaf"
177 Do not optimize by assuming that directories contain 2 fewer
178 subdirectories than their hard link count.  This option is needed when
179 searching filesystems that do not follow the Unix directory-link
180 convention, such as CD-ROM or MS-DOS filesystems or AFS volume mount
181 points.  Each directory on a normal Unix filesystem has at least 2
182 hard links: its name and its `.'  entry.  Additionally, its
183 subdirectories (if any) each have a `..'  entry linked to that
184 directory.  When
185 .B find
186 is examining a directory, after it has statted 2 fewer subdirectories
187 than the directory's link count, it knows that the rest of the entries
188 in the directory are non-directories (`leaf' files in the directory
189 tree).  If only the files' names need to be examined, there is no need
190 to stat them; this gives a significant increase in search speed.
191 .IP "\-version, \-\-version"
192 Print the \fBfind\fR version number and exit.
193 .IP "\-warn, \-nowarn"
194 Turn warning messages on or off.  These warnings apply only to the
195 command line usage, not to any conditions that 
196 .B find 
197 might encounter when it searches directories.  The default behaviour
198 corresponds to \-warn if standard input is a tty, and to -nowarn
199 otherwise.
200 .IP \-xdev
201 Don't descend directories on other filesystems.
203 .SS TESTS
205 Numeric arguments can be specified as
206 .IP \fI+n\fP
207 for greater than
208 .IR n ,
209 .IP \fI\-n\fP
210 for less than
211 .IR n ,
212 .IP \fIn\fP
213 for exactly
214 .IR n .
215 .IP "\-amin \fIn\fR"
216 File was last accessed \fIn\fR minutes ago.
217 .IP "\-anewer \fIfile\fR"
218 File was last accessed more recently than \fIfile\fR was modified.  If
219 \fIfile\fR is a symbolic link and the \-H option or the \-L option is
220 in effect, the access time of the file it points to is always
221 used.
222 .IP "\-atime \fIn\fR"
223 File was last accessed \fIn\fR*24 hours ago.
224 .IP "\-cmin \fIn\fR"
225 File's status was last changed \fIn\fR minutes ago.
226 .IP "\-cnewer \fIfile\fR"
227 File's status was last changed more recently than \fIfile\fR was
228 modified.  If \fIfile\fR is a symbolic link and the \-H option or the
229 \-L option is in effect, the status-change time of the file it points
230 to is always used.
232 .IP "\-ctime \fIn\fR"
233 File's status was last changed \fIn\fR*24 hours ago.
234 .IP \-empty
235 File is empty and is either a regular file or a directory.
236 .IP \-false
237 Always false.
238 .IP "\-fstype \fItype\fR"
239 File is on a filesystem of type \fItype\fR.  The valid filesystem
240 types vary among different versions of Unix; an incomplete list of
241 filesystem types that are accepted on some version of Unix or another
242 is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K.  You can use \-printf
243 with the %F directive to see the types of your filesystems.
244 .IP "\-gid \fIn\fR"
245 File's numeric group ID is \fIn\fR.
246 .IP "\-group \fIgname\fR"
247 File belongs to group \fIgname\fR (numeric group ID allowed).
248 .IP "\-ilname \fIpattern\fR"
249 Like \-lname, but the match is case insensitive.
250 If the \-L option or the \-follow option is in effect, this test 
251 returns false unless the symbolic link is broken.
252 .IP "\-iname \fIpattern\fR"
253 Like \-name, but the match is case insensitive.  For example, the
254 patterns `fo*' and `F??' match the file names `Foo', `FOO', `foo',
255 `fOo', etc.   In these patterns, unlike filename expansion by the
256 shell, an initial '.' can be matched by '*'.  That is, 
257 .B find -name *bar 
258 will match the file `.foobar'.
260 .IP "\-inum \fIn\fR"
261 File has inode number \fIn\fR.
262 .IP "\-ipath \fIpattern\fR"
263 Behaves in the same way as \-iwholename.  This option is deprecated,
264 so please do not use it.
265 .IP "\-iregex \fIpattern\fR"
266 Like \-regex, but the match is case insensitive.
267 .IP "\-iwholename \fIpattern\fR"
268 Like \-wholename, but the match is case insensitive.
269 .IP "\-links \fIn\fR"
270 File has \fIn\fR links.
271 .IP "\-lname \fIpattern\fR"
272 File is a symbolic link whose contents match shell pattern
273 \fIpattern\fR.  The metacharacters do not treat `/' or `.' specially.
274 If the \-L option or the \-follow option is in effect, this test 
275 returns false unless the symbolic link is broken.
276 .IP "\-mmin \fIn\fR"
277 File's data was last modified \fIn\fR minutes ago.
278 .IP "\-mtime \fIn\fR"
279 File's data was last modified \fIn\fR*24 hours ago.
280 .IP "\-name \fIpattern\fR"
281 Base of file name (the path with the leading directories removed)
282 matches shell pattern \fIpattern\fR.  The metacharacters (`*', `?',
283 and `[]') match a `.' at the start of the base name (this is a change
284 in findutils-4.2.2; see section STANDARDS CONFORMANCE below).  To ignore a
285 directory and the files under it, use \-prune; see an example in the
286 description of \-wholename.  Braces are not recognised as being
287 special, despite the fact that some shells including Bash ibmue braces
288 with a special meaning in shell patterns.  The filename matching is
289 performed with the use of the
290 .BR fnmatch (3) 
291 library function.
292 .IP "\-newer \fIfile\fR"
293 File was modified more recently than \fIfile\fR.  If \fIfile\fR is a
294 symbolic link and the \-H option or the \-L option is in effect, the
295 modification time of the file it points to is always used.
296 .IP \-nouser
297 No user corresponds to file's numeric user ID.
298 .IP \-nogroup
299 No group corresponds to file's numeric group ID.
300 .IP "\-path \fIpattern\fR"
301 See \-wholename.   The predicate \-path is also supported by HP-UX 
302 .BR find .
303 .IP "\-perm \fImode\fR"
304 File's permission bits are exactly \fImode\fR (octal or symbolic).
305 Symbolic modes use mode 0 as a point of departure.
306 .IP "\-perm \-\fImode\fR"
307 All of the permission bits \fImode\fR are set for the file.
308 .IP "\-perm +\fImode\fR"
309 Any of the permission bits \fImode\fR are set for the file.
310 .IP "\-regex \fIpattern\fR"
311 File name matches regular expression \fIpattern\fR.  This is a match
312 on the whole path, not a search.  For example, to match a file named
313 `./fubar3', you can use the regular expression `.*bar.' or `.*b.*3',
314 but not `b.*r3'.  The regular expressions understood by 
315 .B find 
316 follow the conventions for the 
317 .B re_match 
318 system library function where this is present (i.e. on systems using
319 the GNU C Library).  On other systems, the implementation within
320 Gnulib is used; by default, Gnulib provides "basic" regular
321 expressions.
322 .IP "\-size \fIn\fR[cwbkMG]"
323 File uses \fIn\fP units of space.  The following suffixes 
324 can be used:
326 .IP `b' 
327 for 512-byte blocks (this is the default if no suffix is used)
328 .IP `c' 
329 for bytes
330 .IP `w' 
331 for two-byte words
332 .IP `k' 
333 for Kilobytes (units of 1024 bytes)
334 .IP `M' 
335 for Megabytes (units of 1048576 bytes)
336 .IP `G' 
337 for Gigabytes (units of 1073741824 bytes)
340 The size does not count indirect blocks, but it does count blocks in
341 sparse files that are not actually allocated.  Bear in mind that the
342 `%k' and `%b' format specifiers of \-printf handle sparse files
343 differently.  The `b' suffix always denotes 512-byte blocks and never
344 1 Kilobyte blocks, which is different to the behaviour of \-ls.
346 .IP \-true
347 Always true.
348 .IP "\-type \fIc\fR"
349 File is of type \fIc\fR:
351 .IP b
352 block (buffered) special
353 .IP c
354 character (unbuffered) special
355 .IP d
356 directory
357 .IP p
358 named pipe (FIFO)
359 .IP f
360 regular file
361 .IP l
362 symbolic link (never true if the \-L option or the \-follow option is
363 in effect, unless the symbolic link is broken).
364 .IP s
365 socket
366 .IP D
367 door (Solaris)
369 .IP "\-uid \fIn\fR"
370 File's numeric user ID is \fIn\fR.
371 .IP "\-used \fIn\fR"
372 File was last accessed \fIn\fR days after its status was last changed.
373 .IP "\-user \fIuname\fR"
374 File is owned by user \fIuname\fR (numeric user ID allowed).
375 .IP "\-wholename \fIpattern\fR"
376 File name matches shell pattern \fIpattern\fR.  The metacharacters do
377 not treat `/' or `.' specially; so, for example,
379 .in +1i
380 find . \-wholename './sr*sc'
382 .in -1i
383 will print an entry for a directory called './src/misc' (if one
384 exists).  To ignore a whole directory tree, use \-prune rather than
385 checking every file in the tree.  For example, to skip the
386 directory `src/emacs' and all files and directories under it, and
387 print the names of the other files found, do something like this:
389 .in +1i
390 find . \-wholename './src/emacs' -prune -o -print
392 .in -1i
393 .IP "\-xtype \fIc\fR"
394 The same as \-type unless the file is a symbolic link.  For symbolic
395 links: if the \-H or \-P option was specified, true if the file is a
396 link to a file of type \fIc\fR; if the \-L option has been given, true
397 if \fIc\fR is `l'.  In other words, for symbolic links, \-xtype checks
398 the type of the file that \-type does not check.
400 .SS ACTIONS
401 .IP "\-delete\fR"
402 Delete files; true if removal succeeded.  If the removal failed, an
403 error message is issued.
405 .IP "\-exec \fIcommand\fR ;"
406 Execute \fIcommand\fR; true if 0 status is returned.  All following
407 arguments to
408 .B find
409 are taken to be arguments to the command until an argument consisting
410 of `;' is encountered.  The string `{}' is replaced by the current
411 file name being processed everywhere it occurs in the arguments to the
412 command, not just in arguments where it is alone, as in some versions
414 .BR find .
415 Both of these constructions might need to be escaped (with a `\e') or
416 quoted to protect them from expansion by the shell.  See the
417 .B EXAMPLES
418 section for examples of the use of the `-exec' option.
419 The command is executed in the starting directory.
421 .IP "\-exec \fIcommand\fR +"
422 This variant of \-exec is not yet supported, but is required by POSIX.
424 .IP "\-fls \fIfile\fR"
425 True; like \-ls but write to \fIfile\fR like \-fprint.
426 The output file is always created, even if the predicate is never matched.
427 .IP "\-fprint \fIfile\fR"
428 True; print the full file name into file \fIfile\fR.  If \fIfile\fR
429 does not exist when \fBfind\fR is run, it is created; if it does
430 exist, it is truncated.  The file names ``/dev/stdout'' and
431 ``/dev/stderr'' are handled specially; they refer to the standard
432 output and standard error output, respectively.
433 The output file is always created, even if the predicate is never matched.
434 .IP "\-fprint0 \fIfile\fR"
435 True; like \-print0 but write to \fIfile\fR like \-fprint.
436 The output file is always created, even if the predicate is never matched.
437 .IP "\-fprintf \fIfile\fR \fIformat\fR"
438 True; like \-printf but write to \fIfile\fR like \-fprint.
439 The output file is always created, even if the predicate is never matched.
440 .IP "\-ok \fIcommand\fR ;"
441 Like \-exec but ask the user first (on the standard input); if the
442 response does not start with `y' or `Y', do not run the command, and
443 return false.
444 .IP \-print
445 True; print the full file name on the standard output, followed by a
446 newline.   If you are piping the output of 
447 .B find 
448 into another program and there is the faintest possibility that the files 
449 which you are searching for might contain a newline, then you should 
450 seriously consider using the `\-print0' option instead of `\-print'.
452 .IP \-print0
453 True; print the full file name on the standard output, followed by a
454 null character (instead of the newline character that `-print' uses).
455 This allows file names that contain newlines or other types of white
456 space to be correctly interpreted by programs that process the
457 \fBfind\fR output.  This option corresponds to the `\-0' option of
458 .BR xargs .
459 .IP "\-printf \fIformat\fR"
460 True; print \fIformat\fR on the standard output, interpreting `\e'
461 escapes and `%' directives.  Field widths and precisions can be
462 specified as with the `printf' C function.  Please note that many of
463 the fields are printed as %s rather than %d, and this may mean that
464 flags don't work as you might expect.  This also means that the `\-'
465 flag does work (it forces fields to be left-aligned).  Unlike \-print,
466 \-printf does not add a newline at the end of the string.  The escapes
467 and directives are:
469 .IP \ea
470 Alarm bell.
471 .IP \eb
472 Backspace.
473 .IP \ec
474 Stop printing from this format immediately and flush the output.
475 .IP \ef
476 Form feed.
477 .IP \en
478 Newline.
479 .IP \er
480 Carriage return.
481 .IP \et
482 Horizontal tab.
483 .IP \ev
484 Vertical tab.
485 .IP \e\0
486 ASCII NUL.
487 .IP \e\e
488 A literal backslash (`\e').
489 .IP \eNNN
490 The character whose ASCII code is NNN (octal).
492 A `\e' character followed by any other character is treated as an
493 ordinary character, so they both are printed.
494 .IP %%
495 A literal percent sign.
496 .IP %a
497 File's last access time in the format returned by the C `ctime' function.
498 .IP %A\fIk\fP
499 File's last access time in the format specified by \fIk\fR, which is
500 either `@' or a directive for the C `strftime' function.  The possible
501 values for \fIk\fR are listed below; some of them might not be
502 available on all systems, due to differences in `strftime' between
503 systems.  
505 .IP @
506 seconds since Jan. 1, 1970, 00:00 GMT.
508 Time fields:
509 .IP H
510 hour (00..23)
511 .IP I
512 hour (01..12)
513 .IP k
514 hour ( 0..23)
515 .IP l
516 hour ( 1..12)
517 .IP M
518 minute (00..59)
519 .IP p
520 locale's AM or PM
521 .IP r
522 time, 12-hour (hh:mm:ss [AP]M)
523 .IP S
524 second (00..61)
525 .IP T
526 time, 24-hour (hh:mm:ss)
527 .IP +
528 Date and time, separated by '+', for example `2004-04-28+22:22:05'.
529 The time is given in the current timezone (which may be affected by
530 setting the TZ environment variable).  This is a GNU extension.
531 .IP X
532 locale's time representation (H:M:S)
533 .IP Z
534 time zone (e.g., EDT), or nothing if no time zone is determinable
536 Date fields:
537 .IP a
538 locale's abbreviated weekday name (Sun..Sat)
539 .IP A
540 locale's full weekday name, variable length (Sunday..Saturday)
541 .IP b
542 locale's abbreviated month name (Jan..Dec)
543 .IP B
544 locale's full month name, variable length (January..December)
545 .IP c
546 locale's date and time (Sat Nov 04 12:02:33 EST 1989)
547 .IP d
548 day of month (01..31)
549 .IP D
550 date (mm/dd/yy)
551 .IP h
552 same as b
553 .IP j
554 day of year (001..366)
555 .IP m
556 month (01..12)
557 .IP U
558 week number of year with Sunday as first day of week (00..53)
559 .IP w
560 day of week (0..6)
561 .IP W
562 week number of year with Monday as first day of week (00..53)
563 .IP x
564 locale's date representation (mm/dd/yy)
565 .IP y
566 last two digits of year (00..99)
567 .IP Y
568 year (1970...)
570 .IP %b
571 File's size in 512-byte blocks (rounded up).
572 .IP %c
573 File's last status change time in the format returned by the C `ctime'
574 function.
575 .IP %C\fIk\fP
576 File's last status change time in the format specified by \fIk\fR,
577 which is the same as for %A.
578 .IP %d
579 File's depth in the directory tree; 0 means the file is a command line
580 argument.
581 .IP %D
582 The device number on which the file exists (the st_dev field of struct
583 stat), in decimal.
584 .IP %f
585 File's name with any leading directories removed (only the last element).
586 .IP %F
587 Type of the filesystem the file is on; this value can be used for
588 \-fstype.
589 .IP %g
590 File's group name, or numeric group ID if the group has no name.
591 .IP %G
592 File's numeric group ID.
593 .IP %h
594 Leading directories of file's name (all but the last element).
595 .IP %H
596 Command line argument under which file was found.
597 .IP %i
598 File's inode number (in decimal).
599 .IP %k
600 The amount of disk space used for this file in 1K blocks (rounded
601 up).  This is different from %s/1024 if the file is a sparse file.
602 .IP %l
603 Object of symbolic link (empty string if file is not a symbolic link).
604 .IP %m
605 File's permission bits (in octal).  This option uses the 'traditional'
606 numbers which most Unix implementations use, but if your particular 
607 implementation uses an unusual ordering of octal permissions bits, you
608 will see a difference between the actual value of the file's mode and
609 the output of %m.   Normally you will want to have a leading
610 zero on this number, and to do this, you should use the 
611 .B #
612 flag (as in, for example, '%#m').
613 .IP %n
614 Number of hard links to file.
615 .IP %p
616 File's name.
617 .IP %P
618 File's name with the name of the command line argument under which
619 it was found removed.
620 .IP %s
621 File's size in bytes.
622 .IP %t
623 File's last modification time in the format returned by the C `ctime'
624 function.
625 .IP %T\fIk\fP
626 File's last modification time in the format specified by \fIk\fR, 
627 which is the same as for %A.
628 .IP %u
629 File's user name, or numeric user ID if the user has no name.
630 .IP %U
631 File's numeric user ID.
632 .IP %y
633 File's type (like in ls -l), U=unknown type (shouldn't happen)
634 .IP %Y
635 File's type (like %y), plus follow symlinks: L=loop, N=nonexistent
637 A `%' character followed by any other character is discarded (but the
638 other character is printed).
640 The %m and %d directives support the 
641 .B #
643 .B 0 
644 and 
645 .B + 
646 flags, but the other directives do not, even if they
647 print numbers.  Numeric directives that do not support these flags
648 include 
649 .BR G , 
650 .BR U , 
651 .BR b , 
652 .BR D , 
653 .B  k 
654 and 
655 .BR n .
656 The `\-' format flag is supported and changes the alignment of a field
657 from right-justified (which is the default) to left-justified.
661 .IP \-prune
662 If \-depth is not given, true; do not descend the current directory.
664 If \-depth is given, false; no effect.
666 .IP "\-quit"
667 Exit immediately with return value zero.  No child proceses will be
668 left running, but no more paths specified on the command line will be 
669 processed.   For example,
670 .B find /tmp/foo /tmp/bar -print -quit
671 will print only
672 .BR /tmp/foo .
675 .IP \-ls
676 True; list current file in `ls \-dils' format on standard output.
677 The block counts are of 1K blocks, unless the environment variable
678 POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
680 .SS OPERATORS
682 Listed in order of decreasing precedence:
683 .IP "( \fIexpr\fR )"
684 Force precedence.
685 .IP "! \fIexpr\fR"
686 True if \fIexpr\fR is false.
687 .IP "\-not \fIexpr\fR"
688 Same as ! \fIexpr\fR.
689 .IP "\fIexpr1 expr2\fR"
690 And (implied); \fIexpr2\fR is not evaluated if \fIexpr1\fR is false.
691 .IP "\fIexpr1\fR \-a \fIexpr2\fR"
692 Same as \fIexpr1 expr2\fR.
693 .IP "\fIexpr1\fR \-and \fIexpr2\fR"
694 Same as \fIexpr1 expr2\fR.
695 .IP "\fIexpr1\fR \-o \fIexpr2\fR"
696 Or; \fIexpr2\fR is not evaluated if \fIexpr1\fR is true.
697 .IP "\fIexpr1\fR \-or \fIexpr2\fR"
698 Same as \fIexpr1\fR \-o \fIexpr2\fR.
699 .IP "\fIexpr1\fR , \fIexpr2\fR"
700 List; both \fIexpr1\fR and \fIexpr2\fR are always evaluated.
701 The value of \fIexpr1\fR is discarded; the value of the list is the
702 value of \fIexpr2\fR.   
703 The comma operator can be useful for searching for several
704 different types of thing, but traversing the filesystem hierarchy only
705 once.   The 
706 .B \-fprintf  
707 action can be used to list the various matched items into several
708 different output files.
711 .SH "STANDARDS CONFORMANCE"
712 The following options are specified in the POSIX standard 
713 (IEEE Std 1003.1, 2003 Edition):
714 .IP "\-H"
715 This option is supported.
716 .IP "\-L"
717 This option is supported.
718 .IP "\-name"
719 This option is supported, but POSIX conformance depends on the 
720 POSIX conformance of the system's 
721 .BR fnmatch (3) 
722 library function.  As of findutils-4.2.2, shell metacharacters
723 ('*'. '?' or '[]' for example) will match a leading '.', because 
724 IEEE interpretation 126 requires this.   This is a change from
725 previous versions of findutils.
726 .IP "\-type"
727 Supported.   POSIX specifies `b', `c', `d', `l', `p', `f' and `s'.
728 GNU find also supports `D', representing a Door, where the OS provides these.
730 .IP "\-ok"
731 Supported.   Interpretation of the response is not locale-dependent
732 (see ENVIRONMENT VARIABLES).
734 .IP "\-exec"
735 Supported for the `{} ;' case, but the '{} +' variant is not supported yet.
737 .IP "\-newer"
738 Supported.  If the file specified is a symbolic link, it is always
739 dereferenced.  This is a change from previous behaviour, which used to 
740 take the relevant time from the symbolic link; see the HISTORY section
741 below.
743 .IP "Other predicates"
744 The predicates
745 `-atime',
746 `-ctime',
747 `-depth',
748 `-group',
749 `-links',
750 `-mtime',
751 `-nogroup',
752 `-nouser',
753 `-perm',
754 `-print',
755 `-prune',
756 `-size',
757 `-user' and 
758 `-xdev',
759 are all supported.
762 The POSIX standard specifies parentheses `(', `)', negation `!' and the
763 `and' and `or' operators (`-a', `-o').   
765 All other options, predicates, expressions and so forth are extensions 
766 beyond the POSIX standard.  Many of these extensions are not unique to 
767 GNU find, however.
769 The \-d option is supported for comatibility with various BSD systems,
770 but you should use the POSIX-compliant predicate \-depth instead.
771 .SH "ENVIRONMENT VARIABLES"
772 .IP POSIXLY_CORRECT
773 Determines the block size used by `-ls'.
774 .IP LANG
775 Provides a default value for the internationalization variables that
776 are unset or null.
777 .IP LC_ALL
778 If set to a non-empty string value, override the values of all the
779 other internationalization variables.
780 .IP LC_COLLATE
781 The POSIX standard specifies that this variable affects the pattern
782 matching to be used for the `-name' option.   GNU find uses the 
783 .BR fnmatch (3) 
784 library function, and so support for `LC_COLLATE' depends on the
785 system library.    
787 POSIX also specifies that the `LC_COLLATE' environment 
788 variable affects the interpretation of the user's response to the 
789 query issued by `-ok', but this is not the case for GNU find.
790 .IP LC_CTYPE 
791 This variable affects the treatment of character classes used with 
792 the `-name' option, if the system's 
793 .BR fnmatch (3) 
794 library function supports this.   It has no effect on the behaviour 
795 of the `-ok' expression.
796 .IP LC_MESSAGES
797 Determines the locale to be used for internationalised messages.
798 .IP NLSPATH
799 Determines the location of the internationalisation message catalogues.
800 .IP PATH
801 Affects the directores which are searched to find the executables 
802 invoked by `-exec' and `-ok'.
803 .SH "EXAMPLES"
805 .B find /tmp -name core -type f -print | xargs /bin/rm -f
808 Find files named 
809 .B core
810 in or below the directory 
811 .B /tmp 
812 and delete them.  Note that this will work incorrectly if there are 
813 any filenames containing newlines, single or double quotes, or spaces.
815 .B find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
818 Find files named 
819 .B core
820 in or below the directory 
821 .B /tmp 
822 and delete them, processing filenames in such a way that file or
823 directory names containing single or double quotes, spaces or newlines
824 are correctly handled.  The
825 .B \-name 
826 test comes before the 
827 .B -type
828 test in order to avoid having to call 
829 .B stat(2) 
830 on every file.
834 .B find . -type f -exec file '{}' \e\;
837 Runs `file' on every file in or below the current directory.  Notice
838 that the braces are enclosed in single quote marks to protect them
839 from interpretation as shell script punctuation.   The semicolon is
840 similarly protected by the use of a backslash, though ';' could have
841 been used in that case also.
845 .B find / \( -perm +4000 -fprintf /root/suid.txt '%#m %u %p\en' \) , \e
846 .B        \( -size +100M -fprintf /root/big.txt  '%-10s %p\en' \)
849 Traverse the filesystem just once, listing setuid files and
850 directories into
851 .B /root/suid.txt
852 and large files into 
853 .BR /root/big/txt .
856 .SH EXIT STATUS
858 .B find
859 exits with status 0 if all files are processed successfully, greater
860 than 0 if errors occur.
861 .SH "SEE ALSO"
862 \fBlocate\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1)
863 \fBFinding Files\fP (on-line in Info, or printed)
864 .SH "HISTORY"
865 As of findutils-4.2.2, shell metacharacters ('*'. '?' or '[]' for
866 example) will match a leading '.', because IEEE interpretation 126
867 requires this.
869 As of findutils-4.2.5, the \-follow option no longer affects whether
870 or not symbolic links specified on the command line are followed for
871 tests like \-newer.  This change coincides with the introduction of
872 the POSIX options \-H and \-L.
874 .SH "BUGS"
875 .P 
876 The best way to report a bug is to use the form at
877 http://savannah.gnu.org/bugs/?group=findutils.  
878 The reason for this is that you will then be able to track progress in
879 fixing the problem.   Other comments about \fBfind\fP(1) and about
880 the findutils package in general can be sent to the 
881 .I bug-findutils
882 mailing list.  To join the list, send email to 
883 .IR bug-findutils-request@gnu.org .