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