]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/find/find.1
This commit was generated by cvs2svn to compensate for changes in r145479,
[FreeBSD/FreeBSD.git] / usr.bin / find / find.1
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)find.1      8.7 (Berkeley) 5/9/95
36 .\" $FreeBSD$
37 .\"
38 .Dd April 2, 2005
39 .Dt FIND 1
40 .Os
41 .Sh NAME
42 .Nm find
43 .Nd walk a file hierarchy
44 .Sh SYNOPSIS
45 .Nm
46 .Op Fl H | Fl L | Fl P
47 .Op Fl EXdsx
48 .Op Fl f Ar pathname
49 .Op Ar pathname ...
50 .Ar expression
51 .Sh DESCRIPTION
52 The
53 .Nm
54 utility recursively descends the directory tree for each
55 .Ar pathname
56 listed, evaluating an
57 .Ar expression
58 (composed of the
59 .Dq primaries
60 and
61 .Dq operands
62 listed below) in terms
63 of each file in the tree.
64 .Pp
65 The options are as follows:
66 .Bl -tag -width indent
67 .It Fl E
68 Interpret regular expressions followed by
69 .Ic -regex
70 and
71 .Ic -iregex
72 options as extended (modern) regular expressions rather than basic
73 regular expressions (BRE's).
74 The
75 .Xr re_format 7
76 manual page fully describes both formats.
77 .It Fl H
78 Cause the file information and file type (see
79 .Xr stat 2 )
80 returned for each symbolic link specified on the command line to be
81 those of the file referenced by the link, not the link itself.
82 If the referenced file does not exist, the file information and type will
83 be for the link itself.
84 File information of all symbolic links not on
85 the command line is that of the link itself.
86 .It Fl L
87 Cause the file information and file type (see
88 .Xr stat 2 )
89 returned for each symbolic link to be those of the file referenced by the
90 link, not the link itself.
91 If the referenced file does not exist, the file information and type will
92 be for the link itself.
93 .Pp
94 This option is equivalent to the deprecated
95 .Ic -follow
96 primary.
97 .It Fl P
98 Cause the file information and file type (see
99 .Xr stat 2 )
100 returned for each symbolic link to be those of the link itself.
101 This is the default.
102 .It Fl X
103 Permit
104 .Nm
105 to be safely used in conjunction with
106 .Xr xargs 1 .
107 If a file name contains any of the delimiting characters used by
108 .Xr xargs 1 ,
109 a diagnostic message is displayed on standard error, and the file
110 is skipped.
111 The delimiting characters include single
112 .Pq Dq Li " ' "
113 and double
114 .Pq Dq Li " \*q "
115 quotes, backslash
116 .Pq Dq Li \e ,
117 space, tab and newline characters.
118 .Pp
119 However, you may wish to consider the
120 .Fl print0
121 primary in conjunction with
122 .Dq Nm xargs Fl 0
123 as an effective alternative.
124 .It Fl d
125 Cause
126 .Nm
127 to perform a depth-first traversal, i.e., directories
128 are visited in post-order and all entries in a directory will be acted
129 on before the directory itself.
130 By default,
131 .Nm
132 visits directories in pre-order, i.e., before their contents.
133 Note, the default is
134 .Em not
135 a breadth-first traversal.
136 .Pp
137 This option is equivalent to the
138 .Ic -depth
139 primary of
140 .St -p1003.1-2001 .
141 .Fl d
142 can be useful when
143 .Nm
144 is used with
145 .Xr cpio 1
146 to process files that are contained in directories with unusual permissions.
147 It ensures that you have write permission while you are placing files in a
148 directory, then sets the directory's permissions as the last thing.
149 .It Fl f
150 Specify a file hierarchy for
151 .Nm
152 to traverse.
153 File hierarchies may also be specified as the operands immediately
154 following the options.
155 .It Fl s
156 Cause
157 .Nm
158 to traverse the file hierarchies in lexicographical order,
159 i.e., alphabetical order within each directory.
160 Note:
161 .Ql find -s
162 and
163 .Ql "find | sort"
164 may give different results.
165 .It Fl x
166 Prevent
167 .Nm
168 from descending into directories that have a device number different
169 than that of the file from which the descent began.
170 .Pp
171 This option is equivalent to the deprecated
172 .Ic -xdev
173 primary.
174 .El
175 .Sh PRIMARIES
176 .Bl -tag -width indent
177 .It Ic -acl
178 May be used in conjunction with other options to locate
179 files with extended ACLs.
180 See
181 .Xr acl 3
182 for more information.
183 .It Ic -amin Ar n
184 True if the difference between the file last access time and the time
185 .Nm
186 was started, rounded up to the next full minute, is
187 .Ar n
188 minutes.
189 .It Ic -anewer Ar file
190 Same as
191 .Ic -neweram .
192 .It Ic -atime Ar n Ns Op Cm smhdw
193 If no units are specified, this primary evaluates to
194 true if the difference between the file last access time and the time
195 .Nm
196 was started, rounded up to the next full 24-hour period, is
197 .Ar n
198 24-hour periods.
199 .Pp
200 If units are specified, this primary evaluates to
201 true if the difference between the file last access time and the time
202 .Nm
203 was started is exactly
204 .Ar n
205 units.
206 Possible time units are as follows:
207 .Pp
208 .Bl -tag -width indent -compact
209 .It Cm s
210 second
211 .It Cm m
212 minute (60 seconds)
213 .It Cm h
214 hour (60 minutes)
215 .It Cm d
216 day (24 hours)
217 .It Cm w
218 week (7 days)
219 .El
220 .Pp
221 Any number of units may be combined in one
222 .Ic -atime
223 argument, for example,
224 .Dq Li "-atime -1h30m" .
225 Units are probably only useful when used in conjunction with the
226 .Cm +
227 or
228 .Cm -
229 modifier.
230 .It Ic -cmin Ar n
231 True if the difference between the time of last change of file status
232 information and the time
233 .Nm
234 was started, rounded up to the next full minute, is
235 .Ar n
236 minutes.
237 .It Ic -cnewer Ar file
238 Same as
239 .Ic -newercm .
240 .It Ic -ctime Ar n Ns Op Cm smhdw
241 If no units are specified, this primary evaluates to
242 true if the difference between the time of last change of file status
243 information and the time
244 .Nm
245 was started, rounded up to the next full 24-hour period, is
246 .Ar n
247 24-hour periods.
248 .Pp
249 If units are specified, this primary evaluates to
250 true if the difference between the time of last change of file status
251 information and the time
252 .Nm
253 was started is exactly
254 .Ar n
255 units.
256 Please refer to the
257 .Ic -atime
258 primary description for information on supported time units.
259 .It Ic -delete
260 Delete found files and/or directories.
261 Always returns true.
262 This executes
263 from the current working directory as
264 .Nm
265 recurses down the tree.
266 It will not attempt to delete a filename with a
267 .Dq Pa /
268 character in its pathname relative to
269 .Dq Pa \&.
270 for security reasons.
271 Depth-first traversal processing is implied by this option.
272 .It Ic -depth
273 Always true;
274 same as the
275 .Fl d
276 option.
277 .It Ic -depth Ar n
278 True if the depth of the file relative to the starting point of the traversal
279 is
280 .Ar n .
281 .It Ic -empty
282 True if the current file or directory is empty.
283 .It Ic -exec Ar utility Oo Ar argument ... Oc Li \&;
284 True if the program named
285 .Ar utility
286 returns a zero value as its exit status.
287 Optional
288 .Ar arguments
289 may be passed to the utility.
290 The expression must be terminated by a semicolon
291 .Pq Dq Li \&; .
292 If you invoke
293 .Nm
294 from a shell you may need to quote the semicolon if the shell would
295 otherwise treat it as a control operator.
296 If the string
297 .Dq Li {}
298 appears anywhere in the utility name or the
299 arguments it is replaced by the pathname of the current file.
300 .Ar Utility
301 will be executed from the directory from which
302 .Nm
303 was executed.
304 .Ar Utility
305 and
306 .Ar arguments
307 are not subject to the further expansion of shell patterns
308 and constructs.
309 .It Ic -exec Ar utility Oo Ar argument ... Oc Li {} +
310 Same as
311 .Ic -exec ,
312 except that
313 .Dq Li {}
314 is replaced with as many pathnames as possible for each invocation of
315 .Ar utility .
316 This behaviour is similar to that of
317 .Xr xargs 1 .
318 .It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&;
319 The
320 .Ic -execdir
321 primary is identical to the
322 .Ic -exec
323 primary with the exception that
324 .Ar utility
325 will be executed from the directory that holds
326 the current file.
327 The filename substituted for
328 the string
329 .Dq Li {}
330 is not qualified.
331 .It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
332 The flags are specified using symbolic names (see
333 .Xr chflags 1 ) .
334 Those with the
335 .Qq Li no
336 prefix (except
337 .Qq Li nodump )
338 are said to be
339 .Ar notflags .
340 Flags in
341 .Ar flags
342 are checked to be set, and flags in
343 .Ar notflags
344 are checked to be not set.
345 Note that this is different from
346 .Ic -perm ,
347 which only allows the user to specify mode bits that are set.
348 .Pp
349 If flags are preceded by a dash
350 .Pq Dq Li - ,
351 this primary evaluates to true
352 if at least all of the bits in
353 .Ar flags
354 and none of the bits in
355 .Ar notflags
356 are set in the file's flags bits.
357 If flags are preceded by a plus
358 .Pq Dq Li + ,
359 this primary evaluates to true
360 if any of the bits in
361 .Ar flags
362 is set in the file's flags bits,
363 or any of the bits in
364 .Ar notflags
365 is not set in the file's flags bits.
366 Otherwise,
367 this primary evaluates to true
368 if the bits in
369 .Ar flags
370 exactly match the file's flags bits,
371 and none of the
372 .Ar flags
373 bits match those of
374 .Ar notflags .
375 .It Ic -fstype Ar type
376 True if the file is contained in a file system of type
377 .Ar type .
378 The
379 .Xr sysctl 8
380 command can be used to find out the types of file systems
381 that are available on the system:
382 .Pp
383 .Dl "sysctl vfs"
384 .Pp
385 In addition, there are two pseudo-types,
386 .Dq Li local
387 and
388 .Dq Li rdonly .
389 The former matches any file system physically mounted on the system where
390 the
391 .Nm
392 is being executed and the latter matches any file system which is
393 mounted read-only.
394 .It Ic -group Ar gname
395 True if the file belongs to the group
396 .Ar gname .
397 If
398 .Ar gname
399 is numeric and there is no such group name, then
400 .Ar gname
401 is treated as a group ID.
402 .It Ic -iname Ar pattern
403 Like
404 .Ic -name ,
405 but the match is case insensitive.
406 .It Ic -inum Ar n
407 True if the file has inode number
408 .Ar n .
409 .It Ic -ipath Ar pattern
410 Like
411 .Ic -path ,
412 but the match is case insensitive.
413 .It Ic -iregex Ar pattern
414 Like
415 .Ic -regex ,
416 but the match is case insensitive.
417 .It Ic -links Ar n
418 True if the file has
419 .Ar n
420 links.
421 .It Ic -ls
422 This primary always evaluates to true.
423 The following information for the current file is written to standard output:
424 its inode number, size in 512-byte blocks, file permissions, number of hard
425 links, owner, group, size in bytes, last modification time, and pathname.
426 If the file is a block or character special file, the major and minor numbers
427 will be displayed instead of the size in bytes.
428 If the file is a symbolic link, the pathname of the linked-to file will be
429 displayed preceded by
430 .Dq Li -> .
431 The format is identical to that produced by
432 .Bk -words
433 .Nm ls Fl dgils .
434 .Ek
435 .It Ic -maxdepth Ar n
436 Always true; descend at most
437 .Ar n
438 directory levels below the command line arguments.
439 If any
440 .Ic -maxdepth
441 primary is specified, it applies to the entire expression even if it would
442 not normally be evaluated.
443 .Ic -maxdepth Li 0
444 limits the whole search to the command line arguments.
445 .It Ic -mindepth Ar n
446 Always true; do not apply any tests or actions at levels less than
447 .Ar n .
448 If any
449 .Ic -mindepth
450 primary is specified, it applies to the entire expression even if it would
451 not normally be evaluated.
452 .Ic -mindepth Li 1
453 processes all but the command line arguments.
454 .It Ic -mmin Ar n
455 True if the difference between the file last modification time and the time
456 .Nm
457 was started, rounded up to the next full minute, is
458 .Ar n
459 minutes.
460 .It Ic -mnewer Ar file
461 Same as
462 .Ic -newer .
463 .It Ic -mtime Ar n Ns Op Cm smhdw
464 If no units are specified, this primary evaluates to
465 true if the difference between the file last modification time and the time
466 .Nm
467 was started, rounded up to the next full 24-hour period, is
468 .Ar n
469 24-hour periods.
470 .Pp
471 If units are specified, this primary evaluates to
472 true if the difference between the file last modification time and the time
473 .Nm
474 was started is exactly
475 .Ar n
476 units.
477 Please refer to the
478 .Ic -atime
479 primary description for information on supported time units.
480 .It Ic -name Ar pattern
481 True if the last component of the pathname being examined matches
482 .Ar pattern .
483 Special shell pattern matching characters
484 .Dq ( Li \&[ ,
485 .Dq Li \&] ,
486 .Dq Li * ,
487 and
488 .Dq Li \&? )
489 may be used as part of
490 .Ar pattern .
491 These characters may be matched explicitly by escaping them with a
492 backslash
493 .Pq Dq Li \e .
494 .It Ic -newer Ar file
495 True if the current file has a more recent last modification time than
496 .Ar file .
497 .It Ic -newer Ns Ar X Ns Ar Y Ar file
498 True if the current file has a more recent last access time
499 .Ar ( X Ns = Ns Cm a ) ,
500 change time
501 .Ar ( X Ns = Ns Cm c ) ,
502 or modification time
503 .Ar ( X Ns = Ns Cm m )
504 than the last access time
505 .Ar ( Y Ns = Ns Cm a ) ,
506 change time
507 .Ar ( Y Ns = Ns Cm c ) ,
508 or modification time
509 .Ar ( Y Ns = Ns Cm m )
510 of
511 .Ar file .
512 In addition, if
513 .Ar Y Ns = Ns Cm t ,
514 then
515 .Ar file
516 is instead interpreted as a direct date specification of the form
517 understood by
518 .Xr cvs 1 .
519 Note that
520 .Ic -newermm
521 is equivalent to
522 .Ic -newer .
523 .It Ic -nogroup
524 True if the file belongs to an unknown group.
525 .It Ic -nouser
526 True if the file belongs to an unknown user.
527 .It Ic -ok Ar utility Oo Ar argument ... Oc Li \&;
528 The
529 .Ic -ok
530 primary is identical to the
531 .Ic -exec
532 primary with the exception that
533 .Nm
534 requests user affirmation for the execution of the
535 .Ar utility
536 by printing
537 a message to the terminal and reading a response.
538 .No If the response is not affirmative ( Ns
539 .Ql y
540 in the
541 .Dq Li POSIX
542 locale),
543 the command is not executed and the
544 value of the
545 .Ic -ok
546 expression is false.
547 .It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&;
548 The
549 .Ic -okdir
550 primary is identical to the
551 .Ic -execdir
552 primary with the same exception as described for the
553 .Ic -ok
554 primary.
555 .It Ic -path Ar pattern
556 True if the pathname being examined matches
557 .Ar pattern .
558 Special shell pattern matching characters
559 .Dq ( Li \&[ ,
560 .Dq Li \&] ,
561 .Dq Li * ,
562 and
563 .Dq Li \&? )
564 may be used as part of
565 .Ar pattern .
566 These characters may be matched explicitly by escaping them with a
567 backslash
568 .Pq Dq Li \e .
569 Slashes
570 .Pq Dq Li /
571 are treated as normal characters and do not have to be
572 matched explicitly.
573 .It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
574 The
575 .Ar mode
576 may be either symbolic (see
577 .Xr chmod 1 )
578 or an octal number.
579 If the
580 .Ar mode
581 is symbolic, a starting value of zero is assumed and the
582 .Ar mode
583 sets or clears permissions without regard to the process' file mode
584 creation mask.
585 If the
586 .Ar mode
587 is octal, only bits 07777
588 .Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
589 of the file's mode bits participate
590 in the comparison.
591 If the
592 .Ar mode
593 is preceded by a dash
594 .Pq Dq Li - ,
595 this primary evaluates to true
596 if at least all of the bits in the
597 .Ar mode
598 are set in the file's mode bits.
599 If the
600 .Ar mode
601 is preceded by a plus
602 .Pq Dq Li + ,
603 this primary evaluates to true
604 if any of the bits in the
605 .Ar mode
606 are set in the file's mode bits.
607 Otherwise, this primary evaluates to true if
608 the bits in the
609 .Ar mode
610 exactly match the file's mode bits.
611 Note, the first character of a symbolic mode may not be a dash
612 .Pq Dq Li - .
613 .It Ic -print
614 This primary always evaluates to true.
615 It prints the pathname of the current file to standard output.
616 If none of
617 .Ic -exec , -ls , -print0 ,
618 or
619 .Ic -ok
620 is specified, the given expression shall be effectively replaced by
621 .Cm \&( Ar "given expression" Cm \&) Ic -print .
622 .It Ic -print0
623 This primary always evaluates to true.
624 It prints the pathname of the current file to standard output, followed by an
625 .Tn ASCII NUL
626 character (character code 0).
627 .It Ic -prune
628 This primary always evaluates to true.
629 It causes
630 .Nm
631 to not descend into the current file.
632 Note, the
633 .Ic -prune
634 primary has no effect if the
635 .Fl d
636 option was specified.
637 .It Ic -regex Ar pattern
638 True if the whole path of the file matches
639 .Ar pattern
640 using regular expression.
641 To match a file named
642 .Dq Pa ./foo/xyzzy ,
643 you can use the regular expression
644 .Dq Li ".*/[xyz]*"
645 or
646 .Dq Li ".*/foo/.*" ,
647 but not
648 .Dq Li xyzzy
649 or
650 .Dq Li /foo/ .
651 .It Ic -size Ar n Ns Op Cm c
652 True if the file's size, rounded up, in 512-byte blocks is
653 .Ar n .
654 If
655 .Ar n
656 is followed by a
657 .Cm c ,
658 then the primary is true if the
659 file's size is
660 .Ar n
661 bytes (characters).
662 .It Ic -type Ar t
663 True if the file is of the specified type.
664 Possible file types are as follows:
665 .Pp
666 .Bl -tag -width indent -compact
667 .It Cm b
668 block special
669 .It Cm c
670 character special
671 .It Cm d
672 directory
673 .It Cm f
674 regular file
675 .It Cm l
676 symbolic link
677 .It Cm p
678 FIFO
679 .It Cm s
680 socket
681 .El
682 .It Ic -user Ar uname
683 True if the file belongs to the user
684 .Ar uname .
685 If
686 .Ar uname
687 is numeric and there is no such user name, then
688 .Ar uname
689 is treated as a user ID.
690 .El
691 .Pp
692 All primaries which take a numeric argument allow the number to be
693 preceded by a plus sign
694 .Pq Dq Li +
695 or a minus sign
696 .Pq Dq Li - .
697 A preceding plus sign means
698 .Dq more than n ,
699 a preceding minus sign means
700 .Dq less than n
701 and neither means
702 .Dq exactly n .
703 .Sh OPERATORS
704 The primaries may be combined using the following operators.
705 The operators are listed in order of decreasing precedence.
706 .Pp
707 .Bl -tag -width "( expression )" -compact
708 .It Cm \&( Ar expression Cm \&)
709 This evaluates to true if the parenthesized expression evaluates to
710 true.
711 .Pp
712 .It Cm \&! Ar expression
713 .It Cm -false Ar expression
714 .It Cm -not Ar expression
715 This is the unary
716 .Tn NOT
717 operator.
718 It evaluates to true if the expression is false.
719 .Pp
720 .It Ar expression Cm -and Ar expression
721 .It Ar expression expression
722 The
723 .Cm -and
724 operator is the logical
725 .Tn AND
726 operator.
727 As it is implied by the juxtaposition of two expressions it does not
728 have to be specified.
729 The expression evaluates to true if both expressions are true.
730 The second expression is not evaluated if the first expression is false.
731 .Pp
732 .It Ar expression Cm -or Ar expression
733 The
734 .Cm -or
735 operator is the logical
736 .Tn OR
737 operator.
738 The expression evaluates to true if either the first or the second expression
739 is true.
740 The second expression is not evaluated if the first expression is true.
741 .El
742 .Pp
743 All operands and primaries must be separate arguments to
744 .Nm .
745 Primaries which themselves take arguments expect each argument
746 to be a separate argument to
747 .Nm .
748 .Sh ENVIRONMENT
749 The
750 .Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
751 and
752 .Ev LC_TIME
753 environment variables affect the execution of the
754 .Nm
755 utility as described in
756 .Xr environ 7 .
757 .Sh EXAMPLES
758 The following examples are shown as given to the shell:
759 .Bl -tag -width indent
760 .It Li "find / \e! -name \*q*.c\*q -print"
761 Print out a list of all the files whose names do not end in
762 .Pa .c .
763 .It Li "find / -newer ttt -user wnj -print"
764 Print out a list of all the files owned by user
765 .Dq wnj
766 that are newer
767 than the file
768 .Pa ttt .
769 .It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
770 Print out a list of all the files which are not both newer than
771 .Pa ttt
772 and owned by
773 .Dq wnj .
774 .It Li "find / \e( -newer ttt -or -user wnj \e) -print"
775 Print out a list of all the files that are either owned by
776 .Dq wnj
777 or that are newer than
778 .Pa ttt .
779 .It Li "find / -newerct '1 minute ago' -print"
780 Print out a list of all the files whose inode change time is more
781 recent than the current time minus one minute.
782 .It Li "find / -type f -exec echo {} \e;"
783 Use the
784 .Xr echo 1
785 command to print out a list of all the files.
786 .It Li "find -L /usr/ports/packages -type l -delete"
787 Delete all broken symbolic links in
788 .Pa /usr/ports/packages .
789 .It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
790 Find files and directories that are at least seven levels deep
791 in the working directory
792 .Pa /usr/src .
793 .It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
794 Is not equivalent to the previous example, since
795 .Ic -prune
796 is not evaluated below level seven.
797 .El
798 .Sh COMPATIBILITY
799 The
800 .Ic -follow
801 primary is deprecated; the
802 .Fl L
803 option should be used instead.
804 See the
805 .Sx STANDARDS
806 section below for details.
807 .Sh SEE ALSO
808 .Xr chflags 1 ,
809 .Xr chmod 1 ,
810 .Xr cvs 1 ,
811 .Xr locate 1 ,
812 .Xr whereis 1 ,
813 .Xr which 1 ,
814 .Xr xargs 1 ,
815 .Xr stat 2 ,
816 .Xr acl 3 ,
817 .Xr fts 3 ,
818 .Xr getgrent 3 ,
819 .Xr getpwent 3 ,
820 .Xr strmode 3 ,
821 .Xr re_format 7 ,
822 .Xr symlink 7
823 .Sh STANDARDS
824 The
825 .Nm
826 utility syntax is a superset of the syntax specified by the
827 .St -p1003.1-2001
828 standard.
829 .Pp
830 All the single character options except
831 .Ic -H
832 and
833 .Ic -L
834 as well as the
835 .Ic -iname , -inum , -iregex , -print0 , -delete , -ls ,
836 and
837 .Ic -regex
838 primaries are extensions to
839 .St -p1003.1-2001 .
840 .Pp
841 Historically, the
842 .Fl d , L
843 and
844 .Fl x
845 options were implemented using the primaries
846 .Ic -depth , -follow ,
847 and
848 .Ic -xdev .
849 These primaries always evaluated to true.
850 As they were really global variables that took effect before the traversal
851 began, some legal expressions could have unexpected results.
852 An example is the expression
853 .Ic -print Cm -o Ic -depth .
854 As
855 .Ic -print
856 always evaluates to true, the standard order of evaluation
857 implies that
858 .Ic -depth
859 would never be evaluated.
860 This is not the case.
861 .Pp
862 The operator
863 .Cm -or
864 was implemented as
865 .Cm -o ,
866 and the operator
867 .Cm -and
868 was implemented as
869 .Cm -a .
870 .Pp
871 Historic implementations of the
872 .Ic -exec
873 and
874 .Ic -ok
875 primaries did not replace the string
876 .Dq Li {}
877 in the utility name or the
878 utility arguments if it had preceding or following non-whitespace characters.
879 This version replaces it no matter where in the utility name or arguments
880 it appears.
881 .Pp
882 The
883 .Fl E
884 option was inspired by the equivalent
885 .Xr grep 1
886 and
887 .Xr sed 1
888 options.
889 .Sh HISTORY
890 A
891 .Nm
892 command appeared in
893 .At v1 .
894 .Sh BUGS
895 The special characters used by
896 .Nm
897 are also special characters to many shell programs.
898 In particular, the characters
899 .Dq Li * ,
900 .Dq Li \&[ ,
901 .Dq Li \&] ,
902 .Dq Li \&? ,
903 .Dq Li \&( ,
904 .Dq Li \&) ,
905 .Dq Li \&! ,
906 .Dq Li \e
907 and
908 .Dq Li \&;
909 may have to be escaped from the shell.
910 .Pp
911 As there is no delimiter separating options and file names or file
912 names and the
913 .Ar expression ,
914 it is difficult to specify files named
915 .Pa -xdev
916 or
917 .Pa \&! .
918 These problems are handled by the
919 .Fl f
920 option and the
921 .Xr getopt 3
922 .Dq Fl Fl
923 construct.
924 .Pp
925 The
926 .Ic -delete
927 primary does not interact well with other options that cause the file system
928 tree traversal options to be changed.
929 .Pp
930 The
931 .Ic -mindepth
932 and
933 .Ic -maxdepth
934 primaries are actually global options (as documented above).
935 They should
936 probably be replaced by options which look like options.