xref: /freebsd/usr.bin/find/find.1 (revision 66c14b21d3ab0b18376563ba643ddb49b4fd33dd)
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 April 4, 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 c
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).
695.It Ic -type Ar t
696True if the file is of the specified type.
697Possible file types are as follows:
698.Pp
699.Bl -tag -width indent -compact
700.It Cm b
701block special
702.It Cm c
703character special
704.It Cm d
705directory
706.It Cm f
707regular file
708.It Cm l
709symbolic link
710.It Cm p
711FIFO
712.It Cm s
713socket
714.El
715.It Ic -user Ar uname
716True if the file belongs to the user
717.Ar uname .
718If
719.Ar uname
720is numeric and there is no such user name, then
721.Ar uname
722is treated as a user ID.
723.El
724.Pp
725All primaries which take a numeric argument allow the number to be
726preceded by a plus sign
727.Pq Dq Li +
728or a minus sign
729.Pq Dq Li - .
730A preceding plus sign means
731.Dq more than n ,
732a preceding minus sign means
733.Dq less than n
734and neither means
735.Dq exactly n .
736.Sh OPERATORS
737The primaries may be combined using the following operators.
738The operators are listed in order of decreasing precedence.
739.Pp
740.Bl -tag -width "( expression )" -compact
741.It Cm \&( Ar expression Cm \&)
742This evaluates to true if the parenthesized expression evaluates to
743true.
744.Pp
745.It Cm \&! Ar expression
746.It Cm -false Ar expression
747.It Cm -not Ar expression
748This is the unary
749.Tn NOT
750operator.
751It evaluates to true if the expression is false.
752.Pp
753.It Ar expression Cm -and Ar expression
754.It Ar expression expression
755The
756.Cm -and
757operator is the logical
758.Tn AND
759operator.
760As it is implied by the juxtaposition of two expressions it does not
761have to be specified.
762The expression evaluates to true if both expressions are true.
763The second expression is not evaluated if the first expression is false.
764.Pp
765.It Ar expression Cm -or Ar expression
766The
767.Cm -or
768operator is the logical
769.Tn OR
770operator.
771The expression evaluates to true if either the first or the second expression
772is true.
773The second expression is not evaluated if the first expression is true.
774.El
775.Pp
776All operands and primaries must be separate arguments to
777.Nm .
778Primaries which themselves take arguments expect each argument
779to be a separate argument to
780.Nm .
781.Sh ENVIRONMENT
782The
783.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES
784and
785.Ev LC_TIME
786environment variables affect the execution of the
787.Nm
788utility as described in
789.Xr environ 7 .
790.Sh EXAMPLES
791The following examples are shown as given to the shell:
792.Bl -tag -width indent
793.It Li "find / \e! -name \*q*.c\*q -print"
794Print out a list of all the files whose names do not end in
795.Pa .c .
796.It Li "find / -newer ttt -user wnj -print"
797Print out a list of all the files owned by user
798.Dq wnj
799that are newer
800than the file
801.Pa ttt .
802.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
803Print out a list of all the files which are not both newer than
804.Pa ttt
805and owned by
806.Dq wnj .
807.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
808Print out a list of all the files that are either owned by
809.Dq wnj
810or that are newer than
811.Pa ttt .
812.It Li "find / -newerct '1 minute ago' -print"
813Print out a list of all the files whose inode change time is more
814recent than the current time minus one minute.
815.It Li "find / -type f -exec echo {} \e;"
816Use the
817.Xr echo 1
818command to print out a list of all the files.
819.It Li "find -L /usr/ports/packages -type l -delete"
820Delete all broken symbolic links in
821.Pa /usr/ports/packages .
822.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
823Find files and directories that are at least seven levels deep
824in the working directory
825.Pa /usr/src .
826.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print"
827Is not equivalent to the previous example, since
828.Ic -prune
829is not evaluated below level seven.
830.El
831.Sh COMPATIBILITY
832The
833.Ic -follow
834primary is deprecated; the
835.Fl L
836option should be used instead.
837See the
838.Sx STANDARDS
839section below for details.
840.Sh SEE ALSO
841.Xr chflags 1 ,
842.Xr chmod 1 ,
843.Xr cvs 1 ,
844.Xr locate 1 ,
845.Xr whereis 1 ,
846.Xr which 1 ,
847.Xr xargs 1 ,
848.Xr stat 2 ,
849.Xr acl 3 ,
850.Xr fts 3 ,
851.Xr getgrent 3 ,
852.Xr getpwent 3 ,
853.Xr strmode 3 ,
854.Xr re_format 7 ,
855.Xr symlink 7
856.Sh STANDARDS
857The
858.Nm
859utility syntax is a superset of the syntax specified by the
860.St -p1003.1-2001
861standard.
862.Pp
863All the single character options except
864.Ic -H
865and
866.Ic -L
867as well as the
868.Ic -iname , -inum , -iregex , -print0 , -delete , -ls , -regex ,
869and all of the
870.Ic -B
871birthtime related primaries are extensions to
872.St -p1003.1-2001 .
873.Pp
874Historically, the
875.Fl d , L
876and
877.Fl x
878options were implemented using the primaries
879.Ic -depth , -follow ,
880and
881.Ic -xdev .
882These primaries always evaluated to true.
883As they were really global variables that took effect before the traversal
884began, some legal expressions could have unexpected results.
885An example is the expression
886.Ic -print Cm -o Ic -depth .
887As
888.Ic -print
889always evaluates to true, the standard order of evaluation
890implies that
891.Ic -depth
892would never be evaluated.
893This is not the case.
894.Pp
895The operator
896.Cm -or
897was implemented as
898.Cm -o ,
899and the operator
900.Cm -and
901was implemented as
902.Cm -a .
903.Pp
904Historic implementations of the
905.Ic -exec
906and
907.Ic -ok
908primaries did not replace the string
909.Dq Li {}
910in the utility name or the
911utility arguments if it had preceding or following non-whitespace characters.
912This version replaces it no matter where in the utility name or arguments
913it appears.
914.Pp
915The
916.Fl E
917option was inspired by the equivalent
918.Xr grep 1
919and
920.Xr sed 1
921options.
922.Sh HISTORY
923A
924.Nm
925command appeared in
926.At v1 .
927.Sh BUGS
928The special characters used by
929.Nm
930are also special characters to many shell programs.
931In particular, the characters
932.Dq Li * ,
933.Dq Li \&[ ,
934.Dq Li \&] ,
935.Dq Li \&? ,
936.Dq Li \&( ,
937.Dq Li \&) ,
938.Dq Li \&! ,
939.Dq Li \e
940and
941.Dq Li \&;
942may have to be escaped from the shell.
943.Pp
944As there is no delimiter separating options and file names or file
945names and the
946.Ar expression ,
947it is difficult to specify files named
948.Pa -xdev
949or
950.Pa \&! .
951These problems are handled by the
952.Fl f
953option and the
954.Xr getopt 3
955.Dq Fl Fl
956construct.
957.Pp
958The
959.Ic -delete
960primary does not interact well with other options that cause the file system
961tree traversal options to be changed.
962.Pp
963The
964.Ic -mindepth
965and
966.Ic -maxdepth
967primaries are actually global options (as documented above).
968They should
969probably be replaced by options which look like options.
970