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