xref: /freebsd/usr.bin/find/find.1 (revision 63518eccca27064285cf2e680510ba9a4c3e2231)
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
58The
59.Nm
60utility recursively descends the directory tree for each
61.Ar pathname
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 -delete
297Delete found files and/or directories.
298Always returns true.
299This executes
300from the current working directory as
301.Nm
302recurses down the tree.
303It will not attempt to delete a filename with a
304.Dq Pa /
305character in its pathname relative to
306.Dq Pa \&.
307for security reasons.
308Depth-first traversal processing is implied by this option.
309.It Ic -depth
310Always true;
311same as the
312.Fl d
313option.
314.It Ic -depth Ar n
315True if the depth of the file relative to the starting point of the traversal
316is
317.Ar n .
318.It Ic -empty
319True if the current file or directory is empty.
320.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&;
321True if the program named
322.Ar utility
323returns a zero value as its exit status.
324Optional
325.Ar arguments
326may be passed to the utility.
327The expression must be terminated by a semicolon
328.Pq Dq Li \&; .
329If you invoke
330.Nm
331from a shell you may need to quote the semicolon if the shell would
332otherwise treat it as a control operator.
333If the string
334.Dq Li {}
335appears anywhere in the utility name or the
336arguments it is replaced by the pathname of the current file.
337.Ar Utility
338will be executed from the directory from which
339.Nm
340was executed.
341.Ar Utility
342and
343.Ar arguments
344are not subject to the further expansion of shell patterns
345and constructs.
346.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} +
347Same as
348.Ic -exec ,
349except that
350.Dq Li {}
351is replaced with as many pathnames as possible for each invocation of
352.Ar utility .
353This behaviour is similar to that of
354.Xr xargs 1 .
355.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&;
356The
357.Ic -execdir
358primary is identical to the
359.Ic -exec
360primary with the exception that
361.Ar utility
362will be executed from the directory that holds
363the current file.
364The filename substituted for
365the string
366.Dq Li {}
367is not qualified.
368.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags
369The flags are specified using symbolic names (see
370.Xr chflags 1 ) .
371Those with the
372.Qq Li no
373prefix (except
374.Qq Li nodump )
375are said to be
376.Ar notflags .
377Flags in
378.Ar flags
379are checked to be set, and flags in
380.Ar notflags
381are checked to be not set.
382Note that this is different from
383.Ic -perm ,
384which only allows the user to specify mode bits that are set.
385.Pp
386If flags are preceded by a dash
387.Pq Dq Li - ,
388this primary evaluates to true
389if at least all of the bits in
390.Ar flags
391and none of the bits in
392.Ar notflags
393are set in the file's flags bits.
394If flags are preceded by a plus
395.Pq Dq Li + ,
396this primary evaluates to true
397if any of the bits in
398.Ar flags
399is set in the file's flags bits,
400or any of the bits in
401.Ar notflags
402is not set in the file's flags bits.
403Otherwise,
404this primary evaluates to true
405if the bits in
406.Ar flags
407exactly match the file's flags bits,
408and none of the
409.Ar flags
410bits match those of
411.Ar notflags .
412.It Ic -fstype Ar type
413True if the file is contained in a file system of type
414.Ar type .
415The
416.Xr sysctl 8
417command can be used to find out the types of file systems
418that are available on the system:
419.Pp
420.Dl "sysctl vfs"
421.Pp
422In addition, there are two pseudo-types,
423.Dq Li local
424and
425.Dq Li rdonly .
426The former matches any file system physically mounted on the system where
427the
428.Nm
429is being executed and the latter matches any file system which is
430mounted read-only.
431.It Ic -group Ar gname
432True if the file belongs to the group
433.Ar gname .
434If
435.Ar gname
436is numeric and there is no such group name, then
437.Ar gname
438is treated as a group ID.
439.It Ic -iname Ar pattern
440Like
441.Ic -name ,
442but the match is case insensitive.
443.It Ic -inum Ar n
444True if the file has inode number
445.Ar n .
446.It Ic -ipath Ar pattern
447Like
448.Ic -path ,
449but the match is case insensitive.
450.It Ic -iregex Ar pattern
451Like
452.Ic -regex ,
453but the match is case insensitive.
454.It Ic -links Ar n
455True if the file has
456.Ar n
457links.
458.It Ic -ls
459This primary always evaluates to true.
460The following information for the current file is written to standard output:
461its inode number, size in 512-byte blocks, file permissions, number of hard
462links, owner, group, size in bytes, last modification time, and pathname.
463If the file is a block or character special file, the major and minor numbers
464will be displayed instead of the size in bytes.
465If the file is a symbolic link, the pathname of the linked-to file will be
466displayed preceded by
467.Dq Li -> .
468The format is identical to that produced by
469.Bk -words
470.Dq Nm ls Fl dgils .
471.Ek
472.It Ic -maxdepth Ar n
473Always true; descend at most
474.Ar n
475directory levels below the command line arguments.
476If any
477.Ic -maxdepth
478primary is specified, it applies to the entire expression even if it would
479not normally be evaluated.
480.Dq Ic -maxdepth Li 0
481limits the whole search to the command line arguments.
482.It Ic -mindepth Ar n
483Always true; do not apply any tests or actions at levels less than
484.Ar n .
485If any
486.Ic -mindepth
487primary is specified, it applies to the entire expression even if it would
488not normally be evaluated.
489.Dq Ic -mindepth Li 1
490processes all but the command line arguments.
491.It Ic -mmin Ar n
492True if the difference between the file last modification time and the time
493.Nm
494was started, rounded up to the next full minute, is
495.Ar n
496minutes.
497.It Ic -mnewer Ar file
498Same as
499.Ic -newer .
500.It Ic -mtime Ar n Ns Op Cm smhdw
501If no units are specified, this primary evaluates to
502true if the difference between the file last modification time and the time
503.Nm
504was started, rounded up to the next full 24-hour period, is
505.Ar n
50624-hour periods.
507.Pp
508If units are specified, this primary evaluates to
509true if the difference between the file last modification time and the time
510.Nm
511was started is exactly
512.Ar n
513units.
514Please refer to the
515.Ic -atime
516primary description for information on supported time units.
517.It Ic -name Ar pattern
518True if the last component of the pathname being examined matches
519.Ar pattern .
520Special shell pattern matching characters
521.Dq ( Li \&[ ,
522.Dq Li \&] ,
523.Dq Li * ,
524and
525.Dq Li \&? )
526may be used as part of
527.Ar pattern .
528These characters may be matched explicitly by escaping them with a
529backslash
530.Pq Dq Li \e .
531.It Ic -newer Ar file
532True 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
535True if the current file has a more recent last access time
536.Pq Ar X Ns = Ns Cm a ,
537inode creation time
538.Pq Ar X Ns = Ns Cm B ,
539change time
540.Pq Ar X Ns = Ns Cm c ,
541or modification time
542.Pq Ar X Ns = Ns Cm m
543than the last access time
544.Pq Ar Y Ns = Ns Cm a ,
545inode creation time
546.Pq Ar Y Ns = Ns Cm B ,
547change time
548.Pq Ar Y Ns = Ns Cm c ,
549or modification time
550.Pq Ar Y Ns = Ns Cm m
551of
552.Ar file .
553In addition, if
554.Ar Y Ns = Ns Cm t ,
555then
556.Ar file
557is instead interpreted as a direct date specification of the form
558understood by
559.Xr cvs 1 .
560Note that
561.Ic -newermm
562is equivalent to
563.Ic -newer .
564.It Ic -nogroup
565True if the file belongs to an unknown group.
566.It Ic -nouser
567True if the file belongs to an unknown user.
568.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&;
569The
570.Ic -ok
571primary is identical to the
572.Ic -exec
573primary with the exception that
574.Nm
575requests user affirmation for the execution of the
576.Ar utility
577by printing
578a message to the terminal and reading a response.
579If the response is not affirmative
580.Ql ( y
581in the
582.Dq Li POSIX
583locale),
584the command is not executed and the
585value of the
586.Ic -ok
587expression is false.
588.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&;
589The
590.Ic -okdir
591primary is identical to the
592.Ic -execdir
593primary with the same exception as described for the
594.Ic -ok
595primary.
596.It Ic -path Ar pattern
597True if the pathname being examined matches
598.Ar pattern .
599Special shell pattern matching characters
600.Dq ( Li \&[ ,
601.Dq Li \&] ,
602.Dq Li * ,
603and
604.Dq Li \&? )
605may be used as part of
606.Ar pattern .
607These characters may be matched explicitly by escaping them with a
608backslash
609.Pq Dq Li \e .
610Slashes
611.Pq Dq Li /
612are treated as normal characters and do not have to be
613matched explicitly.
614.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
615The
616.Ar mode
617may be either symbolic (see
618.Xr chmod 1 )
619or an octal number.
620If the
621.Ar mode
622is symbolic, a starting value of zero is assumed and the
623.Ar mode
624sets or clears permissions without regard to the process' file mode
625creation mask.
626If the
627.Ar mode
628is octal, only bits 07777
629.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO
630of the file's mode bits participate
631in the comparison.
632If the
633.Ar mode
634is preceded by a dash
635.Pq Dq Li - ,
636this primary evaluates to true
637if at least all of the bits in the
638.Ar mode
639are set in the file's mode bits.
640If the
641.Ar mode
642is preceded by a plus
643.Pq Dq Li + ,
644this primary evaluates to true
645if any of the bits in the
646.Ar mode
647are set in the file's mode bits.
648Otherwise, this primary evaluates to true if
649the bits in the
650.Ar mode
651exactly match the file's mode bits.
652Note, the first character of a symbolic mode may not be a dash
653.Pq Dq Li - .
654.It Ic -print
655This primary always evaluates to true.
656It prints the pathname of the current file to standard output.
657If none of
658.Ic -exec , -ls , -print0 ,
659or
660.Ic -ok
661is specified, the given expression shall be effectively replaced by
662.Cm \&( Ar "given expression" Cm \&) Ic -print .
663.It Ic -print0
664This primary always evaluates to true.
665It prints the pathname of the current file to standard output, followed by an
666.Tn ASCII
667.Dv NUL
668character (character code 0).
669.It Ic -prune
670This primary always evaluates to true.
671It causes
672.Nm
673to not descend into the current file.
674Note, the
675.Ic -prune
676primary has no effect if the
677.Fl d
678option was specified.
679.It Ic -regex Ar pattern
680True if the whole path of the file matches
681.Ar pattern
682using regular expression.
683To match a file named
684.Dq Pa ./foo/xyzzy ,
685you can use the regular expression
686.Dq Li ".*/[xyz]*"
687or
688.Dq Li ".*/foo/.*" ,
689but not
690.Dq Li xyzzy
691or
692.Dq Li /foo/ .
693.It Ic -size Ar n Ns Op Cm ckMGTP
694True if the file's size, rounded up, in 512-byte blocks is
695.Ar n .
696If
697.Ar n
698is followed by a
699.Cm c ,
700then the primary is true if the
701file's size is
702.Ar n
703bytes (characters).
704Similarly if
705.Ar n
706is followed by a scale indicator then the file's size is compared to
707.Ar n
708scaled as:
709.Pp
710.Bl -tag -width indent -compact
711.It Cm k
712kilobytes (1024 bytes)
713.It Cm M
714megabytes (1024 kilobytes)
715.It Cm G
716gigabytes (1024 megabytes)
717.It Cm T
718terabytes (1024 gigabytes)
719.It Cm P
720petabytes (1024 terabytes)
721.El
722.It Ic -type Ar t
723True if the file is of the specified type.
724Possible file types are as follows:
725.Pp
726.Bl -tag -width indent -compact
727.It Cm b
728block special
729.It Cm c
730character special
731.It Cm d
732directory
733.It Cm f
734regular file
735.It Cm l
736symbolic link
737.It Cm p
738FIFO
739.It Cm s
740socket
741.El
742.It Ic -user Ar uname
743True if the file belongs to the user
744.Ar uname .
745If
746.Ar uname
747is numeric and there is no such user name, then
748.Ar uname
749is treated as a user ID.
750.El
751.Pp
752All primaries which take a numeric argument allow the number to be
753preceded by a plus sign
754.Pq Dq Li +
755or a minus sign
756.Pq Dq Li - .
757A preceding plus sign means
758.Dq more than n ,
759a preceding minus sign means
760.Dq less than n
761and neither means
762.Dq exactly n .
763.Sh OPERATORS
764The primaries may be combined using the following operators.
765The operators are listed in order of decreasing precedence.
766.Pp
767.Bl -tag -width indent -compact
768.It Cm \&( Ar expression Cm \&)
769This evaluates to true if the parenthesized expression evaluates to
770true.
771.Pp
772.It Cm \&! Ar expression
773.It Cm -false Ar expression
774.It Cm -not Ar expression
775This is the unary
776.Tn NOT
777operator.
778It evaluates to true if the expression is false.
779.Pp
780.It Ar expression Cm -and Ar expression
781.It Ar expression expression
782The
783.Cm -and
784operator is the logical
785.Tn AND
786operator.
787As it is implied by the juxtaposition of two expressions it does not
788have to be specified.
789The expression evaluates to true if both expressions are true.
790The second expression is not evaluated if the first expression is false.
791.Pp
792.It Ar expression Cm -or Ar expression
793The
794.Cm -or
795operator is the logical
796.Tn OR
797operator.
798The expression evaluates to true if either the first or the second expression
799is true.
800The second expression is not evaluated if the first expression is true.
801.El
802.Pp
803All operands and primaries must be separate arguments to
804.Nm .
805Primaries which themselves take arguments expect each argument
806to be a separate argument to
807.Nm .
808.Sh ENVIRONMENT
809The
810.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
811and
812.Ev LC_TIME
813environment variables affect the execution of the
814.Nm
815utility as described in
816.Xr environ 7 .
817.Sh EXAMPLES
818The following examples are shown as given to the shell:
819.Bl -tag -width indent
820.It Li "find / \e! -name \*q*.c\*q -print"
821Print 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"
824Print out a list of all the files owned by user
825.Dq wnj
826that are newer
827than the file
828.Pa ttt .
829.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
830Print out a list of all the files which are not both newer than
831.Pa ttt
832and owned by
833.Dq wnj .
834.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
835Print out a list of all the files that are either owned by
836.Dq wnj
837or that are newer than
838.Pa ttt .
839.It Li "find / -newerct '1 minute ago' -print"
840Print out a list of all the files whose inode change time is more
841recent than the current time minus one minute.
842.It Li "find / -type f -exec echo {} \e;"
843Use the
844.Xr echo 1
845command to print out a list of all the files.
846.It Li "find -L /usr/ports/packages -type l -delete"
847Delete all broken symbolic links in
848.Pa /usr/ports/packages .
849.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
850Find files and directories that are at least seven levels deep
851in the working directory
852.Pa /usr/src .
853.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
854Is not equivalent to the previous example, since
855.Ic -prune
856is not evaluated below level seven.
857.El
858.Sh COMPATIBILITY
859The
860.Ic -follow
861primary is deprecated; the
862.Fl L
863option should be used instead.
864See the
865.Sx STANDARDS
866section 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
884The
885.Nm
886utility syntax is a superset of the syntax specified by the
887.St -p1003.1-2001
888standard.
889.Pp
890All the single character options except
891.Fl H
892and
893.Fl L
894as 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
898and all of the
899.Ic -B*
900birthtime related primaries are extensions to
901.St -p1003.1-2001 .
902.Pp
903Historically, the
904.Fl d , L
905and
906.Fl x
907options were implemented using the primaries
908.Ic -depth , -follow ,
909and
910.Ic -xdev .
911These primaries always evaluated to true.
912As they were really global variables that took effect before the traversal
913began, some legal expressions could have unexpected results.
914An example is the expression
915.Ic -print Cm -o Ic -depth .
916As
917.Ic -print
918always evaluates to true, the standard order of evaluation
919implies that
920.Ic -depth
921would never be evaluated.
922This is not the case.
923.Pp
924The operator
925.Cm -or
926was implemented as
927.Cm -o ,
928and the operator
929.Cm -and
930was implemented as
931.Cm -a .
932.Pp
933Historic implementations of the
934.Ic -exec
935and
936.Ic -ok
937primaries did not replace the string
938.Dq Li {}
939in the utility name or the
940utility arguments if it had preceding or following non-whitespace characters.
941This version replaces it no matter where in the utility name or arguments
942it appears.
943.Pp
944The
945.Fl E
946option was inspired by the equivalent
947.Xr grep 1
948and
949.Xr sed 1
950options.
951.Sh HISTORY
952A
953.Nm
954command appeared in
955.At v1 .
956.Sh BUGS
957The special characters used by
958.Nm
959are also special characters to many shell programs.
960In 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
969and
970.Dq Li \&;
971may have to be escaped from the shell.
972.Pp
973As there is no delimiter separating options and file names or file
974names and the
975.Ar expression ,
976it is difficult to specify files named
977.Pa -xdev
978or
979.Pa \&! .
980These problems are handled by the
981.Fl f
982option and the
983.Xr getopt 3
984.Dq Fl Fl
985construct.
986.Pp
987The
988.Ic -delete
989primary does not interact well with other options that cause the file system
990tree traversal options to be changed.
991.Pp
992The
993.Ic -mindepth
994and
995.Ic -maxdepth
996primaries are actually global options (as documented above).
997They should
998probably be replaced by options which look like options.
999