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