Sun Jan 4 12:13:56 2009 UTC ()
Fix first part of PR 38987 by Robert Elz:
.Dq needs punctuation quoted to mark it up.

I leave 2) and 3) of that PR open for someone else...


(wiz)
diff -r1.66 -r1.67 src/usr.bin/find/find.1

cvs diff -r1.66 -r1.67 src/usr.bin/find/find.1 (switch to unified diff)

--- src/usr.bin/find/find.1 2007/07/19 07:49:30 1.66
+++ src/usr.bin/find/find.1 2009/01/04 12:13:56 1.67
@@ -1,839 +1,839 @@ @@ -1,839 +1,839 @@
1.\" $NetBSD: find.1,v 1.66 2007/07/19 07:49:30 daniel Exp $ 1.\" $NetBSD: find.1,v 1.67 2009/01/04 12:13:56 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1993 3.\" Copyright (c) 1990, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to Berkeley by 6.\" This code is derived from software contributed to Berkeley by
7.\" the Institute of Electrical and Electronics Engineers, Inc. 7.\" the Institute of Electrical and Electronics Engineers, Inc.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the 15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution. 16.\" documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors 17.\" 3. Neither the name of the University nor the names of its contributors
18.\" may be used to endorse or promote products derived from this software 18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission. 19.\" without specific prior written permission.
20.\" 20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" from: @(#)find.1 8.7 (Berkeley) 5/9/95 33.\" from: @(#)find.1 8.7 (Berkeley) 5/9/95
34.\" 34.\"
35.Dd July 19, 2007 35.Dd July 19, 2007
36.Dt FIND 1 36.Dt FIND 1
37.Os 37.Os
38.Sh NAME 38.Sh NAME
39.Nm find 39.Nm find
40.Nd walk a file hierarchy 40.Nd walk a file hierarchy
41.Sh SYNOPSIS 41.Sh SYNOPSIS
42.Nm 42.Nm
43.Op Fl H | Fl L | Fl P 43.Op Fl H | Fl L | Fl P
44.Op Fl dEhsXx 44.Op Fl dEhsXx
45.Ar file 45.Ar file
46.Op Ar file ... 46.Op Ar file ...
47.Op Ar expression 47.Op Ar expression
48.Nm 48.Nm
49.Op Fl H | Fl L | Fl P 49.Op Fl H | Fl L | Fl P
50.Op Fl dEhsXx 50.Op Fl dEhsXx
51.Fl f Ar file 51.Fl f Ar file
52.Op Ar file ... 52.Op Ar file ...
53.Op Ar expression 53.Op Ar expression
54.Sh DESCRIPTION 54.Sh DESCRIPTION
55.Nm 55.Nm
56recursively descends the directory tree for each 56recursively descends the directory tree for each
57.Ar file 57.Ar file
58listed, evaluating an 58listed, evaluating an
59.Ar expression 59.Ar expression
60(composed of the 60(composed of the
61.Dq primaries 61.Dq primaries
62and 62and
63.Dq operands 63.Dq operands
64listed below) in terms 64listed below) in terms
65of each file in the tree. 65of each file in the tree.
66.Pp 66.Pp
67The options are as follows: 67The options are as follows:
68.Pp 68.Pp
69.Bl -tag -width Ds 69.Bl -tag -width Ds
70.It Fl H 70.It Fl H
71The 71The
72.Fl H 72.Fl H
73option causes the file information and file type (see 73option causes the file information and file type (see
74.Xr stat 2 ) , 74.Xr stat 2 ) ,
75returned for each symbolic link encountered on the command line to be 75returned for each symbolic link encountered on the command line to be
76those of the file referenced by the link, not the link itself. 76those of the file referenced by the link, not the link itself.
77If the referenced file does not exist, the file information and type will 77If the referenced file does not exist, the file information and type will
78be for the link itself. 78be for the link itself.
79File information of all symbolic links not on the command line is that 79File information of all symbolic links not on the command line is that
80of the link itself. 80of the link itself.
81.It Fl L 81.It Fl L
82The 82The
83.Fl L 83.Fl L
84option causes the file information and file type (see 84option causes the file information and file type (see
85.Xr stat 2 ) 85.Xr stat 2 )
86returned for each symbolic link to be those of the file referenced by the 86returned for each symbolic link to be those of the file referenced by the
87link, not the link itself. 87link, not the link itself.
88If the referenced file does not exist, the file information and type will 88If the referenced file does not exist, the file information and type will
89be for the link itself. 89be for the link itself.
90.It Fl P 90.It Fl P
91The 91The
92.Fl P 92.Fl P
93option causes the file information and file type (see 93option causes the file information and file type (see
94.Xr stat 2 ) 94.Xr stat 2 )
95returned for each symbolic link to be those of the link itself. 95returned for each symbolic link to be those of the link itself.
96.It Fl d 96.It Fl d
97The 97The
98.Fl d 98.Fl d
99option causes 99option causes
100.Nm 100.Nm
101to perform a depth-first traversal, i.e., directories 101to perform a depth-first traversal, i.e., directories
102are visited in post-order and all entries in a directory will be acted 102are visited in post-order and all entries in a directory will be acted
103on before the directory itself. 103on before the directory itself.
104By default, 104By default,
105.Nm 105.Nm
106visits directories in pre-order, i.e., before their contents. 106visits directories in pre-order, i.e., before their contents.
107Note, the default is 107Note, the default is
108.Ar not 108.Ar not
109a breadth-first traversal. 109a breadth-first traversal.
110.It Fl E 110.It Fl E
111The 111The
112.Fl E 112.Fl E
113option causes 113option causes
114.Ar regexp 114.Ar regexp
115arguments to primaries to be interpreted as extended regular 115arguments to primaries to be interpreted as extended regular
116expressions (see 116expressions (see
117.Xr re_format 7 ) . 117.Xr re_format 7 ) .
118.It Fl f 118.It Fl f
119The 119The
120.Fl f 120.Fl f
121option specifies a file hierarchy for 121option specifies a file hierarchy for
122.Nm 122.Nm
123to traverse. 123to traverse.
124File hierarchies may also be specified as the operands immediately 124File hierarchies may also be specified as the operands immediately
125following the options. 125following the options.
126.It Fl h 126.It Fl h
127The 127The
128.Fl h 128.Fl h
129option causes the file information and file type (see 129option causes the file information and file type (see
130.Xr stat 2 ) , 130.Xr stat 2 ) ,
131returned for each symbolic link to be those of the file referenced by the 131returned for each symbolic link to be those of the file referenced by the
132link, not the link itself. 132link, not the link itself.
133If the referenced file does not exist, the file information and type will 133If the referenced file does not exist, the file information and type will
134be for the link itself. 134be for the link itself.
135.It Fl s 135.It Fl s
136The 136The
137.Fl s 137.Fl s
138option causes the entries of each directory to be sorted in 138option causes the entries of each directory to be sorted in
139lexicographical order. 139lexicographical order.
140Note that the sorting is done only inside of each directory; 140Note that the sorting is done only inside of each directory;
141files in different directories are not sorted. 141files in different directories are not sorted.
142Therefore, 142Therefore,
143.Sq Li a/b 143.Sq Li a/b
144appears before 144appears before
145.Sq Li a.b , 145.Sq Li a.b ,
146which is different from 146which is different from
147.Dq Li "find ... \&| sort" 147.Dq Li "find ... \&| sort"
148order. 148order.
149.It Fl X 149.It Fl X
150The 150The
151.Fl X 151.Fl X
152option is a modification to permit 152option is a modification to permit
153.Nm 153.Nm
154to be safely used in conjunction with 154to be safely used in conjunction with
155.Xr xargs 1 . 155.Xr xargs 1 .
156If a file name contains any of the delimiting characters used by 156If a file name contains any of the delimiting characters used by
157.Nm xargs , 157.Nm xargs ,
158a diagnostic message is displayed on standard error, and the file 158a diagnostic message is displayed on standard error, and the file
159is skipped. 159is skipped.
160The delimiting characters include single 160The delimiting characters include single
161.Pq Dq \&' 161.Pq Dq \&'
162and double 162and double
163.Pq Dq \&" 163.Pq Dq \&"
164quotes, backslash 164quotes, backslash
165.Pq Dq \e , 165.Pq Dq \e ,
166space, tab and newline characters. 166space, tab and newline characters.
167Alternatively, the 167Alternatively, the
168.Ic -print0 168.Ic -print0
169or 169or
170.Ic -printx 170.Ic -printx
171primaries can be used to format the output in a way that 171primaries can be used to format the output in a way that
172.Nm xargs 172.Nm xargs
173can accept. 173can accept.
174.It Fl x 174.It Fl x
175The 175The
176.Fl x 176.Fl x
177option restricts the search to the file system containing the 177option restricts the search to the file system containing the
178directory specified. 178directory specified.
179Does not list mount points to other file systems. 179Does not list mount points to other file systems.
180.El 180.El
181.Sh PRIMARIES 181.Sh PRIMARIES
182.Bl -tag -width Ds 182.Bl -tag -width Ds
183.It Ic -amin Ar n 183.It Ic -amin Ar n
184True if the difference between the file last access time and the time 184True if the difference between the file last access time and the time
185.Nm 185.Nm
186was started, rounded up to the next full minute, is 186was started, rounded up to the next full minute, is
187.Ar n 187.Ar n
188minutes. 188minutes.
189.It Ic -anewer Ar file 189.It Ic -anewer Ar file
190True if the current file has a more recent last access time than 190True if the current file has a more recent last access time than
191.Ar file . 191.Ar file .
192.It Ic -atime Ar n 192.It Ic -atime Ar n
193True if the difference between the file last access time and the time 193True if the difference between the file last access time and the time
194.Nm 194.Nm
195was started, rounded up to the next full 24-hour period, is 195was started, rounded up to the next full 24-hour period, is
196.Ar n 196.Ar n
19724-hour periods. 19724-hour periods.
198.It Ic -cmin Ar n 198.It Ic -cmin Ar n
199True if the difference between the time of last change of file status 199True if the difference between the time of last change of file status
200information and the time 200information and the time
201.Nm 201.Nm
202was started, rounded up to the next full minute, is 202was started, rounded up to the next full minute, is
203.Ar n 203.Ar n
204minutes. 204minutes.
205.It Ic -cnewer Ar file 205.It Ic -cnewer Ar file
206True if the current file has a more recent last change time than 206True if the current file has a more recent last change time than
207.Ar file . 207.Ar file .
208.It Ic -ctime Ar n 208.It Ic -ctime Ar n
209True if the difference between the time of last change of file status 209True if the difference between the time of last change of file status
210information and the time 210information and the time
211.Nm 211.Nm
212was started, rounded up to the next full 24-hour period, is 212was started, rounded up to the next full 24-hour period, is
213.Ar n 213.Ar n
21424-hour periods. 21424-hour periods.
215.It Ic -delete 215.It Ic -delete
216Delete found files and/or directories. 216Delete found files and/or directories.
217Always returns True. 217Always returns True.
218This executes from the current working directory as 218This executes from the current working directory as
219.Nm 219.Nm
220recurses down the tree. 220recurses down the tree.
221It will not attempt to delete a filename with a 221It will not attempt to delete a filename with a
222.Dq \/ 222.Dq /
223character in its pathname relative to 223character in its pathname relative to
224.Dq \. 224.Dq \&.
225for security reasons. 225for security reasons.
226Depth-first traversal processing is implied by this option. 226Depth-first traversal processing is implied by this option.
227This can also be invoked as 227This can also be invoked as
228.Ic -rm . 228.Ic -rm .
229.It Ic -empty 229.It Ic -empty
230True if the current file or directory is empty. 230True if the current file or directory is empty.
231.\" The ".sp" below is probably not the right way to get the desired effect. 231.\" The ".sp" below is probably not the right way to get the desired effect.
232.It Ic -exec Ar utility Oo argument ... Oc No ; 232.It Ic -exec Ar utility Oo argument ... Oc No ;
233.sp -1l 233.sp -1l
234.It Ic -exec Ar utility Oo argument ... Oc No {} + 234.It Ic -exec Ar utility Oo argument ... Oc No {} +
235Execute the specified 235Execute the specified
236.Ar utility 236.Ar utility
237with the specified arguments. 237with the specified arguments.
238The list of arguments is terminated by 238The list of arguments is terminated by
239.Dq Li \&; 239.Dq Li \&;
240or 240or
241.Dq Li \&+ . 241.Dq Li \&+ .
242.Ar utility 242.Ar utility
243will be executed from the directory from which 243will be executed from the directory from which
244.Nm 244.Nm
245was executed. 245was executed.
246.Pp 246.Pp
247If terminated by a semicolon 247If terminated by a semicolon
248.Pq Dq \&; , 248.Pq Dq \&; ,
249the 249the
250.Ar utility 250.Ar utility
251is invoked once per path. 251is invoked once per path.
252If the string 252If the string
253.Dq {} 253.Dq {}
254appears anywhere in the utility name or the arguments, 254appears anywhere in the utility name or the arguments,
255it is replaced by the pathname of the current file. 255it is replaced by the pathname of the current file.
256.Pp 256.Pp
257If terminated by a plus sign 257If terminated by a plus sign
258.Pq Dq \&+ , 258.Pq Dq \&+ ,
259the pathnames for which the 259the pathnames for which the
260primary is evaluated are aggregated into sets, and 260primary is evaluated are aggregated into sets, and
261.Ar utility 261.Ar utility
262will be invoked once per set, similar to 262will be invoked once per set, similar to
263.Xr xargs 1 . 263.Xr xargs 1 .
264If any invocation exits with non-zero exit status, then 264If any invocation exits with non-zero exit status, then
265.Nm 265.Nm
266will eventually do so as well, but this does not cause 266will eventually do so as well, but this does not cause
267.Nm 267.Nm
268to exit early. 268to exit early.
269The string 269The string
270.Dq {} 270.Dq {}
271must appear, and must appear last. 271must appear, and must appear last.
272Each set is limitted to no more than 5,000 pathnames, 272Each set is limitted to no more than 5,000 pathnames,
273and is also limitted such that the invokation of 273and is also limitted such that the invokation of
274.Ar utility 274.Ar utility
275does not exceed 275does not exceed
276.Dv ARG_MAX . 276.Dv ARG_MAX .
277.It Ic -execdir Ar utility Oo argument ... Oc No ; 277.It Ic -execdir Ar utility Oo argument ... Oc No ;
278The 278The
279.Ic -execdir 279.Ic -execdir
280primary is similar to the semicolon-terminated 280primary is similar to the semicolon-terminated
281.Pq Dq \&; 281.Pq Dq \&;
282variant of the 282variant of the
283.Ic -exec 283.Ic -exec
284primary, with the exception that 284primary, with the exception that
285.Ar utility 285.Ar utility
286will be executed from the directory that holds 286will be executed from the directory that holds
287the current file. 287the current file.
288The filename substituted for the string 288The filename substituted for the string
289.Dq {} 289.Dq {}
290is not qualified. 290is not qualified.
291Set aggregation 291Set aggregation
292.Pq Do \&+ Dc termination 292.Pq Do \&+ Dc termination
293is not supported. 293is not supported.
294.It Ic -exit Op Ar n 294.It Ic -exit Op Ar n
295This primary causes 295This primary causes
296.Nm 296.Nm
297to stop traversing the filesystem and exit immediately if a 297to stop traversing the filesystem and exit immediately if a
298previous condition was met. 298previous condition was met.
299If no value is specified, the exit value will be 0, else 299If no value is specified, the exit value will be 0, else
300.Ar n . 300.Ar n .
301Note that other primaries will be evaluated and acted upon before exiting. 301Note that other primaries will be evaluated and acted upon before exiting.
302.It Ic -false 302.It Ic -false
303This primary always evaluates to false. 303This primary always evaluates to false.
304This can be used following a primary that caused the 304This can be used following a primary that caused the
305expression to be true to make the expression to be false. 305expression to be true to make the expression to be false.
306This can be useful after using a 306This can be useful after using a
307.Ic -fprint 307.Ic -fprint
308primary so it can continue to the next expression (using an 308primary so it can continue to the next expression (using an
309.Cm -or 309.Cm -or
310operator, for example). 310operator, for example).
311.It Ic -flags Oo Fl Oc Ns Ar flags 311.It Ic -flags Oo Fl Oc Ns Ar flags
312If 312If
313.Ar flags 313.Ar flags
314are preceded by a dash 314are preceded by a dash
315.Pq Dq - , 315.Pq Dq - ,
316this primary evaluates to true 316this primary evaluates to true
317if at least all of the bits in 317if at least all of the bits in
318.Ar flags 318.Ar flags
319are set in the file's flags bits. 319are set in the file's flags bits.
320If 320If
321.Ar flags 321.Ar flags
322are not preceded by a dash, this primary evaluates to true if 322are not preceded by a dash, this primary evaluates to true if
323the bits in 323the bits in
324.Ar flags 324.Ar flags
325exactly match the file's flags bits. 325exactly match the file's flags bits.
326If 326If
327.Ar flags 327.Ar flags
328is 328is
329.Dq none , 329.Dq none ,
330files with no flags bits set are matched. 330files with no flags bits set are matched.
331(See 331(See
332.Xr chflags 1 332.Xr chflags 1
333for more information about file flags.) 333for more information about file flags.)
334.It Ic -follow 334.It Ic -follow
335Follow symbolic links. 335Follow symbolic links.
336.It Ic -fprint Ar filename 336.It Ic -fprint Ar filename
337This primary always evaluates to true. 337This primary always evaluates to true.
338This creates 338This creates
339.Ar filename 339.Ar filename
340or overwrites the file if it already exists. 340or overwrites the file if it already exists.
341The file is created at startup. 341The file is created at startup.
342It writes the pathname of the current file to this file, followed 342It writes the pathname of the current file to this file, followed
343by a newline character. 343by a newline character.
344The file will be empty if no files are matched. 344The file will be empty if no files are matched.
345.It Ic -fstype Ar type 345.It Ic -fstype Ar type
346True if the file is contained in a file system of type 346True if the file is contained in a file system of type
347.Ar type . 347.Ar type .
348The 348The
349.Xr sysctl 8 349.Xr sysctl 8
350command can be used to find out the types of filesystems 350command can be used to find out the types of filesystems
351that are available on the system: 351that are available on the system:
352.Bd -literal -offset indent 352.Bd -literal -offset indent
353sysctl vfs.generic.fstypes 353sysctl vfs.generic.fstypes
354.Ed 354.Ed
355.Pp 355.Pp
356In addition, there are two pseudo-types, 356In addition, there are two pseudo-types,
357.Dq local 357.Dq local
358and 358and
359.Dq rdonly . 359.Dq rdonly .
360The former matches any file system physically mounted on the system where 360The former matches any file system physically mounted on the system where
361the 361the
362.Nm 362.Nm
363is being executed, and the latter matches any file system which is 363is being executed, and the latter matches any file system which is
364mounted read-only. 364mounted read-only.
365.It Ic -group Ar gname 365.It Ic -group Ar gname
366True if the file belongs to the group 366True if the file belongs to the group
367.Ar gname . 367.Ar gname .
368If 368If
369.Ar gname 369.Ar gname
370is numeric and there is no such group name, then 370is numeric and there is no such group name, then
371.Ar gname 371.Ar gname
372is treated as a group id. 372is treated as a group id.
373.It Ic -iname Ar pattern 373.It Ic -iname Ar pattern
374True if the last component of the pathname being examined 374True if the last component of the pathname being examined
375matches 375matches
376.Ar pattern . 376.Ar pattern .
377Case insensitive. 377Case insensitive.
378.It Ic -inum Ar n 378.It Ic -inum Ar n
379True if the file has inode number 379True if the file has inode number
380.Ar n . 380.Ar n .
381.It Ic -iregex Ar regexp 381.It Ic -iregex Ar regexp
382True if the path name of the current file matches the case-insensitive 382True if the path name of the current file matches the case-insensitive
383basic regular expression 383basic regular expression
384.Pq see Xr re_format 7 384.Pq see Xr re_format 7
385.Ar regexp . 385.Ar regexp .
386This is a match on the whole path, not a search for the regular expression 386This is a match on the whole path, not a search for the regular expression
387within the path. 387within the path.
388.It Ic -links Ar n 388.It Ic -links Ar n
389True if the file has 389True if the file has
390.Ar n 390.Ar n
391links. 391links.
392.It Ic -rm 392.It Ic -rm
393This is an alias for 393This is an alias for
394.Ic -delete . 394.Ic -delete .
395.It Ic -ls 395.It Ic -ls
396This primary always evaluates to true. 396This primary always evaluates to true.
397The following information for the current file is written to standard output: 397The following information for the current file is written to standard output:
398its inode number, size in 512-byte blocks, file permissions, number of hard 398its inode number, size in 512-byte blocks, file permissions, number of hard
399links, owner, group, size in bytes, last modification time, and pathname. 399links, owner, group, size in bytes, last modification time, and pathname.
400If the file is a block or character special file, the major and minor numbers 400If the file is a block or character special file, the major and minor numbers
401will be displayed instead of the size in bytes. 401will be displayed instead of the size in bytes.
402If the file is a symbolic link, the pathname of the linked-to file will be 402If the file is a symbolic link, the pathname of the linked-to file will be
403displayed preceded by 403displayed preceded by
404.Dq -\*[Gt] . 404.Dq -\*[Gt] .
405The format is identical to that produced by 405The format is identical to that produced by
406.Dq ls -dgils . 406.Dq ls -dgils .
407.It Ic -maxdepth Ar n 407.It Ic -maxdepth Ar n
408True if the current search depth is less than or equal to what is specified in 408True if the current search depth is less than or equal to what is specified in
409.Ar n . 409.Ar n .
410.It Ic -mindepth Ar n 410.It Ic -mindepth Ar n
411True if the current search depth is at least what is specified in 411True if the current search depth is at least what is specified in
412.Ar n . 412.Ar n .
413.It Ic -mmin Ar n 413.It Ic -mmin Ar n
414True if the difference between the file last modification time and the time 414True if the difference between the file last modification time and the time
415.Nm 415.Nm
416was started, rounded up to the next full minute, is 416was started, rounded up to the next full minute, is
417.Ar n 417.Ar n
418minutes. 418minutes.
419.It Ic -mtime Ar n 419.It Ic -mtime Ar n
420True if the difference between the file last modification time and the time 420True if the difference between the file last modification time and the time
421.Nm 421.Nm
422was started, rounded up to the next full 24-hour period, is 422was started, rounded up to the next full 24-hour period, is
423.Ar n 423.Ar n
42424-hour periods. 42424-hour periods.
425.It Ic -ok Ar utility Oo argument ... Oc No ; 425.It Ic -ok Ar utility Oo argument ... Oc No ;
426The 426The
427.Ic -ok 427.Ic -ok
428primary is similar to the semicolon-terminated 428primary is similar to the semicolon-terminated
429.Pq Dq \&; 429.Pq Dq \&;
430variant of the 430variant of the
431.Ic -exec 431.Ic -exec
432primary, with the exception that 432primary, with the exception that
433.Nm 433.Nm
434requests user affirmation for the execution of the utility by printing 434requests user affirmation for the execution of the utility by printing
435a message to the terminal and reading a response. 435a message to the terminal and reading a response.
436If the response is other than 436If the response is other than
437.Dq y , 437.Dq y ,
438the command is not executed and the 438the command is not executed and the
439.Ar -ok 439.Ar -ok
440primary evaluates to false. 440primary evaluates to false.
441Set aggregation 441Set aggregation
442.Pq Do \&+ Dc termination 442.Pq Do \&+ Dc termination
443is not supported. 443is not supported.
444.It Ic -name Ar pattern 444.It Ic -name Ar pattern
445True if the last component of the pathname being examined matches 445True if the last component of the pathname being examined matches
446.Ar pattern . 446.Ar pattern .
447Special shell pattern matching characters 447Special shell pattern matching characters
448.Po 448.Po
449.Dq \&[ , 449.Dq \&[ ,
450.Dq \&] , 450.Dq \&] ,
451.Dq \&* , 451.Dq \&* ,
452.Dq \&? 452.Dq \&?
453.Pc 453.Pc
454may be used as part of 454may be used as part of
455.Ar pattern . 455.Ar pattern .
456These characters may be matched explicitly by escaping them with a 456These characters may be matched explicitly by escaping them with a
457backslash 457backslash
458.Pq Dq \e . 458.Pq Dq \e .
459.It Ic -newer Ar file 459.It Ic -newer Ar file
460True if the current file has a more recent last modification time than 460True if the current file has a more recent last modification time than
461.Ar file . 461.Ar file .
462.It Ic -nouser 462.It Ic -nouser
463True if the file belongs to an unknown user. 463True if the file belongs to an unknown user.
464.It Ic -nogroup 464.It Ic -nogroup
465True if the file belongs to an unknown group. 465True if the file belongs to an unknown group.
466.It Ic -path Ar pattern 466.It Ic -path Ar pattern
467True if the pathname being examined matches 467True if the pathname being examined matches
468.Ar pattern . 468.Ar pattern .
469Special shell pattern matching characters 469Special shell pattern matching characters
470.Po 470.Po
471.Dq \&[ , 471.Dq \&[ ,
472.Dq \&] , 472.Dq \&] ,
473.Dq \&* , 473.Dq \&* ,
474and 474and
475.Dq \&? 475.Dq \&?
476.Pc 476.Pc
477may be used as part of 477may be used as part of
478.Ar pattern . 478.Ar pattern .
479These characters may be matched explicitly by escaping them with a 479These characters may be matched explicitly by escaping them with a
480backslash 480backslash
481.Pq Dq \e . 481.Pq Dq \e .
482Slashes 482Slashes
483.Pq Dq / 483.Pq Dq /
484are treated as normal characters and do not have to be 484are treated as normal characters and do not have to be
485matched explicitly. 485matched explicitly.
486.It Ic -perm Oo Fl Oc Ns Ar mode 486.It Ic -perm Oo Fl Oc Ns Ar mode
487The 487The
488.Ar mode 488.Ar mode
489may be either symbolic (see 489may be either symbolic (see
490.Xr chmod 1 ) 490.Xr chmod 1 )
491or an octal number. 491or an octal number.
492If the mode is symbolic, a starting value of zero is assumed and the 492If the mode is symbolic, a starting value of zero is assumed and the
493mode sets or clears permissions without regard to the process' file mode 493mode sets or clears permissions without regard to the process' file mode
494creation mask. 494creation mask.
495If the mode is octal, only bits 07777 495If the mode is octal, only bits 07777
496.Pf ( Dv S_ISUID 496.Pf ( Dv S_ISUID
497| 497|
498.Dv S_ISGID 498.Dv S_ISGID
499| 499|
500.Dv S_ISTXT 500.Dv S_ISTXT
501| 501|
502.Dv S_IRWXU 502.Dv S_IRWXU
503| 503|
504.Dv S_IRWXG 504.Dv S_IRWXG
505| 505|
506.Dv S_IRWXO ) 506.Dv S_IRWXO )
507of the file's mode bits participate 507of the file's mode bits participate
508in the comparison. 508in the comparison.
509If the mode is preceded by a dash 509If the mode is preceded by a dash
510.Pq Dq - , 510.Pq Dq - ,
511this primary evaluates to true 511this primary evaluates to true
512if at least all of the bits in the mode are set in the file's mode bits. 512if at least all of the bits in the mode are set in the file's mode bits.
513If the mode is not preceded by a dash, this primary evaluates to true if 513If the mode is not preceded by a dash, this primary evaluates to true if
514the bits in the mode exactly match the file's mode bits. 514the bits in the mode exactly match the file's mode bits.
515Note, the first character of a symbolic mode may not be a dash 515Note, the first character of a symbolic mode may not be a dash
516.Pq Dq - . 516.Pq Dq - .
517.It Ic -print 517.It Ic -print
518This primary always evaluates to true. 518This primary always evaluates to true.
519It prints the pathname of the current file to standard output, followed 519It prints the pathname of the current file to standard output, followed
520by a newline character. 520by a newline character.
521If none of 521If none of
522.Ic -exec , 522.Ic -exec ,
523.Ic -exit , 523.Ic -exit ,
524.Ic -fprint , 524.Ic -fprint ,
525.Ic -ls , 525.Ic -ls ,
526.Ic -ok , 526.Ic -ok ,
527.Ic -print0 , 527.Ic -print0 ,
528nor 528nor
529.Ic -printx 529.Ic -printx
530is specified, the given expression shall be effectively replaced by 530is specified, the given expression shall be effectively replaced by
531.Cm \&( Ns Ar given\& expression Ns Cm \&) 531.Cm \&( Ns Ar given\& expression Ns Cm \&)
532.Ic -print . 532.Ic -print .
533.It Ic -print0 533.It Ic -print0
534This primary always evaluates to true. 534This primary always evaluates to true.
535It prints the pathname of the current file to standard output, followed 535It prints the pathname of the current file to standard output, followed
536by a null character. 536by a null character.
537.It Ic -printx 537.It Ic -printx
538This primary always evaluates to true. 538This primary always evaluates to true.
539It prints the pathname of the current file to standard output, 539It prints the pathname of the current file to standard output,
540with each space, tab, newline, backslash, dollar sign, and single, 540with each space, tab, newline, backslash, dollar sign, and single,
541double, or back quotation mark prefixed by a backslash, so the output of 541double, or back quotation mark prefixed by a backslash, so the output of
542.Nm find 542.Nm find
543can safely be used as input to 543can safely be used as input to
544.Nm xargs . 544.Nm xargs .
545.It Ic -prune 545.It Ic -prune
546This primary always evaluates to true. 546This primary always evaluates to true.
547It causes 547It causes
548.Nm 548.Nm
549to not descend into the current file. 549to not descend into the current file.
550Note, the 550Note, the
551.Ic -prune 551.Ic -prune
552primary has no effect if the 552primary has no effect if the
553.Fl d 553.Fl d
554option was specified. 554option was specified.
555.It Ic -regex Ar regexp 555.It Ic -regex Ar regexp
556True if the path name of the current file matches the case-sensitive 556True if the path name of the current file matches the case-sensitive
557basic regular expression 557basic regular expression
558.Pq see Xr re_format 7 558.Pq see Xr re_format 7
559.Ar regexp . 559.Ar regexp .
560This is a match on the whole path, not a search for the regular expression 560This is a match on the whole path, not a search for the regular expression
561within the path. 561within the path.
562.It Ic -size Ar n Ns Op Cm c 562.It Ic -size Ar n Ns Op Cm c
563True if the file's size, rounded up, in 512-byte blocks is 563True if the file's size, rounded up, in 512-byte blocks is
564.Ar n . 564.Ar n .
565If 565If
566.Ar n 566.Ar n
567is followed by a 567is followed by a
568.Dq c , 568.Dq c ,
569then the primary is true if the file's size is 569then the primary is true if the file's size is
570.Ar n 570.Ar n
571bytes. 571bytes.
572.It Ic -type Ar t 572.It Ic -type Ar t
573True if the file is of the specified type. 573True if the file is of the specified type.
574Possible file types are as follows: 574Possible file types are as follows:
575.Pp 575.Pp
576.Bl -tag -width flag -offset indent -compact 576.Bl -tag -width flag -offset indent -compact
577.It Cm b 577.It Cm b
578block special 578block special
579.It Cm c 579.It Cm c
580character special 580character special
581.It Cm d 581.It Cm d
582directory 582directory
583.It Cm f 583.It Cm f
584regular file 584regular file
585.It Cm l 585.It Cm l
586symbolic link 586symbolic link
587.It Cm p 587.It Cm p
588FIFO 588FIFO
589.It Cm s 589.It Cm s
590socket 590socket
591.It Cm W 591.It Cm W
592whiteout 592whiteout
593.It Cm w 593.It Cm w
594whiteout 594whiteout
595.El 595.El
596.Pp 596.Pp
597.It Ic -user Ar uname 597.It Ic -user Ar uname
598True if the file belongs to the user 598True if the file belongs to the user
599.Ar uname . 599.Ar uname .
600If 600If
601.Ar uname 601.Ar uname
602is numeric and there is no such user name, then 602is numeric and there is no such user name, then
603.Ar uname 603.Ar uname
604is treated as a user id (and considered a numeric argument). 604is treated as a user id (and considered a numeric argument).
605.It Ic -xdev 605.It Ic -xdev
606This primary always evaluates to true. 606This primary always evaluates to true.
607It causes find not to descend past directories that have a different 607It causes find not to descend past directories that have a different
608device ID (st_dev, see 608device ID (st_dev, see
609.Xr stat 2 609.Xr stat 2
610S5.6.2 [POSIX.1]). 610S5.6.2 [POSIX.1]).
611.El 611.El
612.Pp 612.Pp
613All primaries which take a numeric argument allow the number to be 613All primaries which take a numeric argument allow the number to be
614preceded by a plus sign 614preceded by a plus sign
615.Pq Dq + 615.Pq Dq +
616or a minus sign 616or a minus sign
617.Pq Dq \- . 617.Pq Dq \- .
618A preceding plus sign means 618A preceding plus sign means
619.Dq more than n , 619.Dq more than n ,
620a preceding minus sign means 620a preceding minus sign means
621.Dq less than n , 621.Dq less than n ,
622and neither means 622and neither means
623.Dq exactly n . 623.Dq exactly n .
624.Sh OPERATORS 624.Sh OPERATORS
625The primaries may be combined using the following operators. 625The primaries may be combined using the following operators.
626The operators are listed in order of decreasing precedence. 626The operators are listed in order of decreasing precedence.
627.Bl -tag -width (expression) 627.Bl -tag -width (expression)
628.It Cm \&( Ar expression Cm \&) 628.It Cm \&( Ar expression Cm \&)
629This evaluates to true if the parenthesized expression evaluates to 629This evaluates to true if the parenthesized expression evaluates to
630true. 630true.
631.Pp 631.Pp
632.It Cm \&! Ar expression 632.It Cm \&! Ar expression
633This is the unary 633This is the unary
634.Tn NOT 634.Tn NOT
635operator. 635operator.
636It evaluates to true if the expression is false. 636It evaluates to true if the expression is false.
637.Pp 637.Pp
638.It Ar expression Cm -and Ar expression 638.It Ar expression Cm -and Ar expression
639.It Ar expression expression 639.It Ar expression expression
640The 640The
641.Cm -and 641.Cm -and
642operator is the logical 642operator is the logical
643.Tn AND 643.Tn AND
644operator. 644operator.
645As it is implied by the juxtaposition of two expressions it does not 645As it is implied by the juxtaposition of two expressions it does not
646have to be specified. 646have to be specified.
647The expression evaluates to true if both expressions are true. 647The expression evaluates to true if both expressions are true.
648The second expression is not evaluated if the first expression is false. 648The second expression is not evaluated if the first expression is false.
649.Pp 649.Pp
650.It Ar expression Cm -or Ar expression 650.It Ar expression Cm -or Ar expression
651The 651The
652.Cm -or 652.Cm -or
653operator is the logical 653operator is the logical
654.Tn OR 654.Tn OR
655operator. 655operator.
656The expression evaluates to true if either the first or the second expression 656The expression evaluates to true if either the first or the second expression
657is true. 657is true.
658The second expression is not evaluated if the first expression is true. 658The second expression is not evaluated if the first expression is true.
659.El 659.El
660.Pp 660.Pp
661All operands and primaries must be separate arguments to 661All operands and primaries must be separate arguments to
662.Nm . 662.Nm .
663Primaries which themselves take arguments expect each argument 663Primaries which themselves take arguments expect each argument
664to be a separate argument to 664to be a separate argument to
665.Nm . 665.Nm .
666.Sh EXIT STATUS 666.Sh EXIT STATUS
667The 667The
668.Nm 668.Nm
669utility normally exits 0 on success, and exits with 1 under certain 669utility normally exits 0 on success, and exits with 1 under certain
670internal error conditions. 670internal error conditions.
671If any invokations of 671If any invokations of
672.Dq Ic -exec Ar ... No + 672.Dq Ic -exec Ar ... No +
673primaries return non-zero exit-status, then 673primaries return non-zero exit-status, then
674.Nm 674.Nm
675will do so as well. 675will do so as well.
676.Sh EXAMPLES 676.Sh EXAMPLES
677The following examples are shown as given to the shell: 677The following examples are shown as given to the shell:
678.Bl -tag -width findx 678.Bl -tag -width findx
679.It Li "find / \e! -name \*q*.c\*q -print" 679.It Li "find / \e! -name \*q*.c\*q -print"
680Print out a list of all the files whose names do not end in 680Print out a list of all the files whose names do not end in
681.Dq \&.c . 681.Dq \&.c .
682.It Li "find / -newer ttt -user wnj -print" 682.It Li "find / -newer ttt -user wnj -print"
683Print out a list of all the files owned by user 683Print out a list of all the files owned by user
684.Dq wnj 684.Dq wnj
685that are newer than the file 685that are newer than the file
686.Dq ttt . 686.Dq ttt .
687.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 687.It Li "find / \e! \e( -newer ttt -user wnj \e) -print"
688Print out a list of all the files which are not both newer than 688Print out a list of all the files which are not both newer than
689.Dq ttt 689.Dq ttt
690and owned by 690and owned by
691.Dq wnj . 691.Dq wnj .
692.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 692.It Li "find / \e( -newer ttt -or -user wnj \e) -print"
693Print out a list of all the files that are either owned by 693Print out a list of all the files that are either owned by
694.Dq wnj 694.Dq wnj
695or that are newer than 695or that are newer than
696.Dq ttt . 696.Dq ttt .
697.It Li "find / \e( -newer ttt -or -user wnj \e) -exit 1" 697.It Li "find / \e( -newer ttt -or -user wnj \e) -exit 1"
698Return immediately with a value of 1 if any files are found that are either 698Return immediately with a value of 1 if any files are found that are either
699owned by 699owned by
700.Dq wnj 700.Dq wnj
701or that are newer than 701or that are newer than
702.Dq ttt , 702.Dq ttt ,
703but do not print them. 703but do not print them.
704.It Li "find / \e( -newer ttt -or -user wnj \e) -ls -exit 1" 704.It Li "find / \e( -newer ttt -or -user wnj \e) -ls -exit 1"
705Same as above, but list the first file matching the criteria before exiting 705Same as above, but list the first file matching the criteria before exiting
706with a value of 1. 706with a value of 1.
707.El 707.El
708.Sh SEE ALSO 708.Sh SEE ALSO
709.Xr chflags 1 , 709.Xr chflags 1 ,
710.Xr chmod 1 , 710.Xr chmod 1 ,
711.Xr locate 1 , 711.Xr locate 1 ,
712.Xr xargs 1 , 712.Xr xargs 1 ,
713.Xr stat 2 , 713.Xr stat 2 ,
714.Xr fts 3 , 714.Xr fts 3 ,
715.Xr getgrent 3 , 715.Xr getgrent 3 ,
716.Xr getpwent 3 , 716.Xr getpwent 3 ,
717.Xr strmode 3 , 717.Xr strmode 3 ,
718.Xr symlink 7 , 718.Xr symlink 7 ,
719.Xr sysctl 8 719.Xr sysctl 8
720.Sh STANDARDS 720.Sh STANDARDS
721The 721The
722.Nm 722.Nm
723utility syntax is a superset of the syntax specified by the 723utility syntax is a superset of the syntax specified by the
724.St -p1003.2 724.St -p1003.2
725standard. 725standard.
726.Pp 726.Pp
727The options and the 727The options and the
728.Ic -amin , 728.Ic -amin ,
729.Ic -anewer , 729.Ic -anewer ,
730.Ic -cmin , 730.Ic -cmin ,
731.Ic -cnewer , 731.Ic -cnewer ,
732.Ic -delete , 732.Ic -delete ,
733.Ic -empty , 733.Ic -empty ,
734.Ic -execdir , 734.Ic -execdir ,
735.Ic -follow , 735.Ic -follow ,
736.Ic -fstype , 736.Ic -fstype ,
737.Ic -iname , 737.Ic -iname ,
738.Ic -inum , 738.Ic -inum ,
739.Ic -iregex , 739.Ic -iregex ,
740.Ic -links , 740.Ic -links ,
741.Ic -ls , 741.Ic -ls ,
742.Ic -maxdepth , 742.Ic -maxdepth ,
743.Ic -mindepth , 743.Ic -mindepth ,
744.Ic -mmin , 744.Ic -mmin ,
745.Ic -path , 745.Ic -path ,
746.Ic -print0 , 746.Ic -print0 ,
747.Ic -printx , 747.Ic -printx ,
748.Ic -regex , 748.Ic -regex ,
749and 749and
750.Ic -rm 750.Ic -rm
751primaries are extensions to 751primaries are extensions to
752.St -p1003.2 . 752.St -p1003.2 .
753.Pp 753.Pp
754Historically, the 754Historically, the
755.Fl d , 755.Fl d ,
756.Fl h , 756.Fl h ,
757and 757and
758.Fl x 758.Fl x
759options were implemented using the primaries 759options were implemented using the primaries
760.Dq -depth , 760.Dq -depth ,
761.Dq -follow , 761.Dq -follow ,
762and 762and
763.Dq -xdev . 763.Dq -xdev .
764These primaries always evaluated to true. 764These primaries always evaluated to true.
765As they were really global variables that took effect before the traversal 765As they were really global variables that took effect before the traversal
766began, some legal expressions could have unexpected results. 766began, some legal expressions could have unexpected results.
767An example is the expression 767An example is the expression
768.Dq -print -o -depth . 768.Dq -print -o -depth .
769As -print always evaluates to true, the standard order of evaluation 769As -print always evaluates to true, the standard order of evaluation
770implies that -depth would never be evaluated. 770implies that -depth would never be evaluated.
771This is not the case. 771This is not the case.
772.Pp 772.Pp
773The operator 773The operator
774.Dq -or 774.Dq -or
775was implemented as 775was implemented as
776.Dq -o , 776.Dq -o ,
777and the operator 777and the operator
778.Dq -and 778.Dq -and
779was implemented as 779was implemented as
780.Dq -a . 780.Dq -a .
781.Pp 781.Pp
782Historic implementations of the 782Historic implementations of the
783.Ic -exec 783.Ic -exec
784and 784and
785.Ic -ok 785.Ic -ok
786primaries did not replace the string 786primaries did not replace the string
787.Dq {} 787.Dq {}
788in the utility name or the 788in the utility name or the
789utility arguments if it had preceding or following non-whitespace characters. 789utility arguments if it had preceding or following non-whitespace characters.
790This version replaces it no matter where in the utility name or arguments 790This version replaces it no matter where in the utility name or arguments
791it appears. 791it appears.
792.Pp 792.Pp
793Support for 793Support for
794.Dq Ic -exec Ar ... No + 794.Dq Ic -exec Ar ... No +
795is consistent with 795is consistent with
796.Em IEEE PASC Interpretation 1003.2 #210 , 796.Em IEEE PASC Interpretation 1003.2 #210 ,
797though the feature originated in 797though the feature originated in
798.Tn SVR4 . 798.Tn SVR4 .
799.Pp 799.Pp
800The 800The
801.Ic -delete 801.Ic -delete
802primary does not interact well with other options that cause the filesystem 802primary does not interact well with other options that cause the filesystem
803tree traversal options to be changed. 803tree traversal options to be changed.
804.Sh HISTORY 804.Sh HISTORY
805A much simpler 805A much simpler
806.Nm find 806.Nm find
807command appeared in First Edition AT\*[Am]T Unix. 807command appeared in First Edition AT\*[Am]T Unix.
808The syntax had become similar to the present version by 808The syntax had become similar to the present version by
809the time of the Fifth Edition. 809the time of the Fifth Edition.
810.Sh BUGS 810.Sh BUGS
811The special characters used by 811The special characters used by
812.Nm 812.Nm
813are also special characters to many shell programs. 813are also special characters to many shell programs.
814In particular, the characters 814In particular, the characters
815.Dq \&* , 815.Dq \&* ,
816.Dq \&[ , 816.Dq \&[ ,
817.Dq \&] , 817.Dq \&] ,
818.Dq \&? , 818.Dq \&? ,
819.Dq \&( , 819.Dq \&( ,
820.Dq \&) , 820.Dq \&) ,
821.Dq \&! , 821.Dq \&! ,
822.Dq \e , 822.Dq \e ,
823and 823and
824.Dq \&; 824.Dq \&;
825may have to be escaped from the shell. 825may have to be escaped from the shell.
826.Pp 826.Pp
827As there is no delimiter separating options and file names or file 827As there is no delimiter separating options and file names or file
828names and the 828names and the
829.Ar expression , 829.Ar expression ,
830it is difficult to specify files named 830it is difficult to specify files named
831.Dq -xdev 831.Dq -xdev
832or 832or
833.Dq \&! . 833.Dq \&! .
834These problems are handled by the 834These problems are handled by the
835.Fl f 835.Fl f
836option and the 836option and the
837.Xr getopt 3 837.Xr getopt 3
838.Dq -- 838.Dq --
839construct. 839construct.