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