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