| @@ -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 |
56 | recursively descends the directory tree for each | | 56 | recursively descends the directory tree for each |
57 | .Ar file | | 57 | .Ar file |
58 | listed, evaluating an | | 58 | listed, evaluating an |
59 | .Ar expression | | 59 | .Ar expression |
60 | (composed of the | | 60 | (composed of the |
61 | .Dq primaries | | 61 | .Dq primaries |
62 | and | | 62 | and |
63 | .Dq operands | | 63 | .Dq operands |
64 | listed below) in terms | | 64 | listed below) in terms |
65 | of each file in the tree. | | 65 | of each file in the tree. |
66 | .Pp | | 66 | .Pp |
67 | The options are as follows: | | 67 | The 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 |
71 | The | | 71 | The |
72 | .Fl H | | 72 | .Fl H |
73 | option causes the file information and file type (see | | 73 | option causes the file information and file type (see |
74 | .Xr stat 2 ) , | | 74 | .Xr stat 2 ) , |
75 | returned for each symbolic link encountered on the command line to be | | 75 | returned for each symbolic link encountered on the command line to be |
76 | those of the file referenced by the link, not the link itself. | | 76 | those of the file referenced by the link, not the link itself. |
77 | If the referenced file does not exist, the file information and type will | | 77 | If the referenced file does not exist, the file information and type will |
78 | be for the link itself. | | 78 | be for the link itself. |
79 | File information of all symbolic links not on the command line is that | | 79 | File information of all symbolic links not on the command line is that |
80 | of the link itself. | | 80 | of the link itself. |
81 | .It Fl L | | 81 | .It Fl L |
82 | The | | 82 | The |
83 | .Fl L | | 83 | .Fl L |
84 | option causes the file information and file type (see | | 84 | option causes the file information and file type (see |
85 | .Xr stat 2 ) | | 85 | .Xr stat 2 ) |
86 | returned for each symbolic link to be those of the file referenced by the | | 86 | returned for each symbolic link to be those of the file referenced by the |
87 | link, not the link itself. | | 87 | link, not the link itself. |
88 | If the referenced file does not exist, the file information and type will | | 88 | If the referenced file does not exist, the file information and type will |
89 | be for the link itself. | | 89 | be for the link itself. |
90 | .It Fl P | | 90 | .It Fl P |
91 | The | | 91 | The |
92 | .Fl P | | 92 | .Fl P |
93 | option causes the file information and file type (see | | 93 | option causes the file information and file type (see |
94 | .Xr stat 2 ) | | 94 | .Xr stat 2 ) |
95 | returned for each symbolic link to be those of the link itself. | | 95 | returned for each symbolic link to be those of the link itself. |
96 | .It Fl d | | 96 | .It Fl d |
97 | The | | 97 | The |
98 | .Fl d | | 98 | .Fl d |
99 | option causes | | 99 | option causes |
100 | .Nm | | 100 | .Nm |
101 | to perform a depth-first traversal, i.e., directories | | 101 | to perform a depth-first traversal, i.e., directories |
102 | are visited in post-order and all entries in a directory will be acted | | 102 | are visited in post-order and all entries in a directory will be acted |
103 | on before the directory itself. | | 103 | on before the directory itself. |
104 | By default, | | 104 | By default, |
105 | .Nm | | 105 | .Nm |
106 | visits directories in pre-order, i.e., before their contents. | | 106 | visits directories in pre-order, i.e., before their contents. |
107 | Note, the default is | | 107 | Note, the default is |
108 | .Ar not | | 108 | .Ar not |
109 | a breadth-first traversal. | | 109 | a breadth-first traversal. |
110 | .It Fl E | | 110 | .It Fl E |
111 | The | | 111 | The |
112 | .Fl E | | 112 | .Fl E |
113 | option causes | | 113 | option causes |
114 | .Ar regexp | | 114 | .Ar regexp |
115 | arguments to primaries to be interpreted as extended regular | | 115 | arguments to primaries to be interpreted as extended regular |
116 | expressions (see | | 116 | expressions (see |
117 | .Xr re_format 7 ) . | | 117 | .Xr re_format 7 ) . |
118 | .It Fl f | | 118 | .It Fl f |
119 | The | | 119 | The |
120 | .Fl f | | 120 | .Fl f |
121 | option specifies a file hierarchy for | | 121 | option specifies a file hierarchy for |
122 | .Nm | | 122 | .Nm |
123 | to traverse. | | 123 | to traverse. |
124 | File hierarchies may also be specified as the operands immediately | | 124 | File hierarchies may also be specified as the operands immediately |
125 | following the options. | | 125 | following the options. |
126 | .It Fl h | | 126 | .It Fl h |
127 | The | | 127 | The |
128 | .Fl h | | 128 | .Fl h |
129 | option causes the file information and file type (see | | 129 | option causes the file information and file type (see |
130 | .Xr stat 2 ) , | | 130 | .Xr stat 2 ) , |
131 | returned for each symbolic link to be those of the file referenced by the | | 131 | returned for each symbolic link to be those of the file referenced by the |
132 | link, not the link itself. | | 132 | link, not the link itself. |
133 | If the referenced file does not exist, the file information and type will | | 133 | If the referenced file does not exist, the file information and type will |
134 | be for the link itself. | | 134 | be for the link itself. |
135 | .It Fl s | | 135 | .It Fl s |
136 | The | | 136 | The |
137 | .Fl s | | 137 | .Fl s |
138 | option causes the entries of each directory to be sorted in | | 138 | option causes the entries of each directory to be sorted in |
139 | lexicographical order. | | 139 | lexicographical order. |
140 | Note that the sorting is done only inside of each directory; | | 140 | Note that the sorting is done only inside of each directory; |
141 | files in different directories are not sorted. | | 141 | files in different directories are not sorted. |
142 | Therefore, | | 142 | Therefore, |
143 | .Sq Li a/b | | 143 | .Sq Li a/b |
144 | appears before | | 144 | appears before |
145 | .Sq Li a.b , | | 145 | .Sq Li a.b , |
146 | which is different from | | 146 | which is different from |
147 | .Dq Li "find ... \&| sort" | | 147 | .Dq Li "find ... \&| sort" |
148 | order. | | 148 | order. |
149 | .It Fl X | | 149 | .It Fl X |
150 | The | | 150 | The |
151 | .Fl X | | 151 | .Fl X |
152 | option is a modification to permit | | 152 | option is a modification to permit |
153 | .Nm | | 153 | .Nm |
154 | to be safely used in conjunction with | | 154 | to be safely used in conjunction with |
155 | .Xr xargs 1 . | | 155 | .Xr xargs 1 . |
156 | If a file name contains any of the delimiting characters used by | | 156 | If a file name contains any of the delimiting characters used by |
157 | .Nm xargs , | | 157 | .Nm xargs , |
158 | a diagnostic message is displayed on standard error, and the file | | 158 | a diagnostic message is displayed on standard error, and the file |
159 | is skipped. | | 159 | is skipped. |
160 | The delimiting characters include single | | 160 | The delimiting characters include single |
161 | .Pq Dq \&' | | 161 | .Pq Dq \&' |
162 | and double | | 162 | and double |
163 | .Pq Dq \&" | | 163 | .Pq Dq \&" |
164 | quotes, backslash | | 164 | quotes, backslash |
165 | .Pq Dq \e , | | 165 | .Pq Dq \e , |
166 | space, tab and newline characters. | | 166 | space, tab and newline characters. |
167 | Alternatively, the | | 167 | Alternatively, the |
168 | .Ic -print0 | | 168 | .Ic -print0 |
169 | or | | 169 | or |
170 | .Ic -printx | | 170 | .Ic -printx |
171 | primaries can be used to format the output in a way that | | 171 | primaries can be used to format the output in a way that |
172 | .Nm xargs | | 172 | .Nm xargs |
173 | can accept. | | 173 | can accept. |
174 | .It Fl x | | 174 | .It Fl x |
175 | The | | 175 | The |
176 | .Fl x | | 176 | .Fl x |
177 | option restricts the search to the file system containing the | | 177 | option restricts the search to the file system containing the |
178 | directory specified. | | 178 | directory specified. |
179 | Does not list mount points to other file systems. | | 179 | Does 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 |
184 | True if the difference between the file last access time and the time | | 184 | True if the difference between the file last access time and the time |
185 | .Nm | | 185 | .Nm |
186 | was started, rounded up to the next full minute, is | | 186 | was started, rounded up to the next full minute, is |
187 | .Ar n | | 187 | .Ar n |
188 | minutes. | | 188 | minutes. |
189 | .It Ic -anewer Ar file | | 189 | .It Ic -anewer Ar file |
190 | True if the current file has a more recent last access time than | | 190 | True 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 |
193 | True if the difference between the file last access time and the time | | 193 | True if the difference between the file last access time and the time |
194 | .Nm | | 194 | .Nm |
195 | was started, rounded up to the next full 24-hour period, is | | 195 | was started, rounded up to the next full 24-hour period, is |
196 | .Ar n | | 196 | .Ar n |
197 | 24-hour periods. | | 197 | 24-hour periods. |
198 | .It Ic -cmin Ar n | | 198 | .It Ic -cmin Ar n |
199 | True if the difference between the time of last change of file status | | 199 | True if the difference between the time of last change of file status |
200 | information and the time | | 200 | information and the time |
201 | .Nm | | 201 | .Nm |
202 | was started, rounded up to the next full minute, is | | 202 | was started, rounded up to the next full minute, is |
203 | .Ar n | | 203 | .Ar n |
204 | minutes. | | 204 | minutes. |
205 | .It Ic -cnewer Ar file | | 205 | .It Ic -cnewer Ar file |
206 | True if the current file has a more recent last change time than | | 206 | True 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 |
209 | True if the difference between the time of last change of file status | | 209 | True if the difference between the time of last change of file status |
210 | information and the time | | 210 | information and the time |
211 | .Nm | | 211 | .Nm |
212 | was started, rounded up to the next full 24-hour period, is | | 212 | was started, rounded up to the next full 24-hour period, is |
213 | .Ar n | | 213 | .Ar n |
214 | 24-hour periods. | | 214 | 24-hour periods. |
215 | .It Ic -delete | | 215 | .It Ic -delete |
216 | Delete found files and/or directories. | | 216 | Delete found files and/or directories. |
217 | Always returns True. | | 217 | Always returns True. |
218 | This executes from the current working directory as | | 218 | This executes from the current working directory as |
219 | .Nm | | 219 | .Nm |
220 | recurses down the tree. | | 220 | recurses down the tree. |
221 | It will not attempt to delete a filename with a | | 221 | It will not attempt to delete a filename with a |
222 | .Dq \/ | | 222 | .Dq / |
223 | character in its pathname relative to | | 223 | character in its pathname relative to |
224 | .Dq \. | | 224 | .Dq \&. |
225 | for security reasons. | | 225 | for security reasons. |
226 | Depth-first traversal processing is implied by this option. | | 226 | Depth-first traversal processing is implied by this option. |
227 | This can also be invoked as | | 227 | This can also be invoked as |
228 | .Ic -rm . | | 228 | .Ic -rm . |
229 | .It Ic -empty | | 229 | .It Ic -empty |
230 | True if the current file or directory is empty. | | 230 | True 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 {} + |
235 | Execute the specified | | 235 | Execute the specified |
236 | .Ar utility | | 236 | .Ar utility |
237 | with the specified arguments. | | 237 | with the specified arguments. |
238 | The list of arguments is terminated by | | 238 | The list of arguments is terminated by |
239 | .Dq Li \&; | | 239 | .Dq Li \&; |
240 | or | | 240 | or |
241 | .Dq Li \&+ . | | 241 | .Dq Li \&+ . |
242 | .Ar utility | | 242 | .Ar utility |
243 | will be executed from the directory from which | | 243 | will be executed from the directory from which |
244 | .Nm | | 244 | .Nm |
245 | was executed. | | 245 | was executed. |
246 | .Pp | | 246 | .Pp |
247 | If terminated by a semicolon | | 247 | If terminated by a semicolon |
248 | .Pq Dq \&; , | | 248 | .Pq Dq \&; , |
249 | the | | 249 | the |
250 | .Ar utility | | 250 | .Ar utility |
251 | is invoked once per path. | | 251 | is invoked once per path. |
252 | If the string | | 252 | If the string |
253 | .Dq {} | | 253 | .Dq {} |
254 | appears anywhere in the utility name or the arguments, | | 254 | appears anywhere in the utility name or the arguments, |
255 | it is replaced by the pathname of the current file. | | 255 | it is replaced by the pathname of the current file. |
256 | .Pp | | 256 | .Pp |
257 | If terminated by a plus sign | | 257 | If terminated by a plus sign |
258 | .Pq Dq \&+ , | | 258 | .Pq Dq \&+ , |
259 | the pathnames for which the | | 259 | the pathnames for which the |
260 | primary is evaluated are aggregated into sets, and | | 260 | primary is evaluated are aggregated into sets, and |
261 | .Ar utility | | 261 | .Ar utility |
262 | will be invoked once per set, similar to | | 262 | will be invoked once per set, similar to |
263 | .Xr xargs 1 . | | 263 | .Xr xargs 1 . |
264 | If any invocation exits with non-zero exit status, then | | 264 | If any invocation exits with non-zero exit status, then |
265 | .Nm | | 265 | .Nm |
266 | will eventually do so as well, but this does not cause | | 266 | will eventually do so as well, but this does not cause |
267 | .Nm | | 267 | .Nm |
268 | to exit early. | | 268 | to exit early. |
269 | The string | | 269 | The string |
270 | .Dq {} | | 270 | .Dq {} |
271 | must appear, and must appear last. | | 271 | must appear, and must appear last. |
272 | Each set is limitted to no more than 5,000 pathnames, | | 272 | Each set is limitted to no more than 5,000 pathnames, |
273 | and is also limitted such that the invokation of | | 273 | and is also limitted such that the invokation of |
274 | .Ar utility | | 274 | .Ar utility |
275 | does not exceed | | 275 | does 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 ; |
278 | The | | 278 | The |
279 | .Ic -execdir | | 279 | .Ic -execdir |
280 | primary is similar to the semicolon-terminated | | 280 | primary is similar to the semicolon-terminated |
281 | .Pq Dq \&; | | 281 | .Pq Dq \&; |
282 | variant of the | | 282 | variant of the |
283 | .Ic -exec | | 283 | .Ic -exec |
284 | primary, with the exception that | | 284 | primary, with the exception that |
285 | .Ar utility | | 285 | .Ar utility |
286 | will be executed from the directory that holds | | 286 | will be executed from the directory that holds |
287 | the current file. | | 287 | the current file. |
288 | The filename substituted for the string | | 288 | The filename substituted for the string |
289 | .Dq {} | | 289 | .Dq {} |
290 | is not qualified. | | 290 | is not qualified. |
291 | Set aggregation | | 291 | Set aggregation |
292 | .Pq Do \&+ Dc termination | | 292 | .Pq Do \&+ Dc termination |
293 | is not supported. | | 293 | is not supported. |
294 | .It Ic -exit Op Ar n | | 294 | .It Ic -exit Op Ar n |
295 | This primary causes | | 295 | This primary causes |
296 | .Nm | | 296 | .Nm |
297 | to stop traversing the filesystem and exit immediately if a | | 297 | to stop traversing the filesystem and exit immediately if a |
298 | previous condition was met. | | 298 | previous condition was met. |
299 | If no value is specified, the exit value will be 0, else | | 299 | If no value is specified, the exit value will be 0, else |
300 | .Ar n . | | 300 | .Ar n . |
301 | Note that other primaries will be evaluated and acted upon before exiting. | | 301 | Note that other primaries will be evaluated and acted upon before exiting. |
302 | .It Ic -false | | 302 | .It Ic -false |
303 | This primary always evaluates to false. | | 303 | This primary always evaluates to false. |
304 | This can be used following a primary that caused the | | 304 | This can be used following a primary that caused the |
305 | expression to be true to make the expression to be false. | | 305 | expression to be true to make the expression to be false. |
306 | This can be useful after using a | | 306 | This can be useful after using a |
307 | .Ic -fprint | | 307 | .Ic -fprint |
308 | primary so it can continue to the next expression (using an | | 308 | primary so it can continue to the next expression (using an |
309 | .Cm -or | | 309 | .Cm -or |
310 | operator, for example). | | 310 | operator, for example). |
311 | .It Ic -flags Oo Fl Oc Ns Ar flags | | 311 | .It Ic -flags Oo Fl Oc Ns Ar flags |
312 | If | | 312 | If |
313 | .Ar flags | | 313 | .Ar flags |
314 | are preceded by a dash | | 314 | are preceded by a dash |
315 | .Pq Dq - , | | 315 | .Pq Dq - , |
316 | this primary evaluates to true | | 316 | this primary evaluates to true |
317 | if at least all of the bits in | | 317 | if at least all of the bits in |
318 | .Ar flags | | 318 | .Ar flags |
319 | are set in the file's flags bits. | | 319 | are set in the file's flags bits. |
320 | If | | 320 | If |
321 | .Ar flags | | 321 | .Ar flags |
322 | are not preceded by a dash, this primary evaluates to true if | | 322 | are not preceded by a dash, this primary evaluates to true if |
323 | the bits in | | 323 | the bits in |
324 | .Ar flags | | 324 | .Ar flags |
325 | exactly match the file's flags bits. | | 325 | exactly match the file's flags bits. |
326 | If | | 326 | If |
327 | .Ar flags | | 327 | .Ar flags |
328 | is | | 328 | is |
329 | .Dq none , | | 329 | .Dq none , |
330 | files with no flags bits set are matched. | | 330 | files with no flags bits set are matched. |
331 | (See | | 331 | (See |
332 | .Xr chflags 1 | | 332 | .Xr chflags 1 |
333 | for more information about file flags.) | | 333 | for more information about file flags.) |
334 | .It Ic -follow | | 334 | .It Ic -follow |
335 | Follow symbolic links. | | 335 | Follow symbolic links. |
336 | .It Ic -fprint Ar filename | | 336 | .It Ic -fprint Ar filename |
337 | This primary always evaluates to true. | | 337 | This primary always evaluates to true. |
338 | This creates | | 338 | This creates |
339 | .Ar filename | | 339 | .Ar filename |
340 | or overwrites the file if it already exists. | | 340 | or overwrites the file if it already exists. |
341 | The file is created at startup. | | 341 | The file is created at startup. |
342 | It writes the pathname of the current file to this file, followed | | 342 | It writes the pathname of the current file to this file, followed |
343 | by a newline character. | | 343 | by a newline character. |
344 | The file will be empty if no files are matched. | | 344 | The file will be empty if no files are matched. |
345 | .It Ic -fstype Ar type | | 345 | .It Ic -fstype Ar type |
346 | True if the file is contained in a file system of type | | 346 | True if the file is contained in a file system of type |
347 | .Ar type . | | 347 | .Ar type . |
348 | The | | 348 | The |
349 | .Xr sysctl 8 | | 349 | .Xr sysctl 8 |
350 | command can be used to find out the types of filesystems | | 350 | command can be used to find out the types of filesystems |
351 | that are available on the system: | | 351 | that are available on the system: |
352 | .Bd -literal -offset indent | | 352 | .Bd -literal -offset indent |
353 | sysctl vfs.generic.fstypes | | 353 | sysctl vfs.generic.fstypes |
354 | .Ed | | 354 | .Ed |
355 | .Pp | | 355 | .Pp |
356 | In addition, there are two pseudo-types, | | 356 | In addition, there are two pseudo-types, |
357 | .Dq local | | 357 | .Dq local |
358 | and | | 358 | and |
359 | .Dq rdonly . | | 359 | .Dq rdonly . |
360 | The former matches any file system physically mounted on the system where | | 360 | The former matches any file system physically mounted on the system where |
361 | the | | 361 | the |
362 | .Nm | | 362 | .Nm |
363 | is being executed, and the latter matches any file system which is | | 363 | is being executed, and the latter matches any file system which is |
364 | mounted read-only. | | 364 | mounted read-only. |
365 | .It Ic -group Ar gname | | 365 | .It Ic -group Ar gname |
366 | True if the file belongs to the group | | 366 | True if the file belongs to the group |
367 | .Ar gname . | | 367 | .Ar gname . |
368 | If | | 368 | If |
369 | .Ar gname | | 369 | .Ar gname |
370 | is numeric and there is no such group name, then | | 370 | is numeric and there is no such group name, then |
371 | .Ar gname | | 371 | .Ar gname |
372 | is treated as a group id. | | 372 | is treated as a group id. |
373 | .It Ic -iname Ar pattern | | 373 | .It Ic -iname Ar pattern |
374 | True if the last component of the pathname being examined | | 374 | True if the last component of the pathname being examined |
375 | matches | | 375 | matches |
376 | .Ar pattern . | | 376 | .Ar pattern . |
377 | Case insensitive. | | 377 | Case insensitive. |
378 | .It Ic -inum Ar n | | 378 | .It Ic -inum Ar n |
379 | True if the file has inode number | | 379 | True if the file has inode number |
380 | .Ar n . | | 380 | .Ar n . |
381 | .It Ic -iregex Ar regexp | | 381 | .It Ic -iregex Ar regexp |
382 | True if the path name of the current file matches the case-insensitive | | 382 | True if the path name of the current file matches the case-insensitive |
383 | basic regular expression | | 383 | basic regular expression |
384 | .Pq see Xr re_format 7 | | 384 | .Pq see Xr re_format 7 |
385 | .Ar regexp . | | 385 | .Ar regexp . |
386 | This is a match on the whole path, not a search for the regular expression | | 386 | This is a match on the whole path, not a search for the regular expression |
387 | within the path. | | 387 | within the path. |
388 | .It Ic -links Ar n | | 388 | .It Ic -links Ar n |
389 | True if the file has | | 389 | True if the file has |
390 | .Ar n | | 390 | .Ar n |
391 | links. | | 391 | links. |
392 | .It Ic -rm | | 392 | .It Ic -rm |
393 | This is an alias for | | 393 | This is an alias for |
394 | .Ic -delete . | | 394 | .Ic -delete . |
395 | .It Ic -ls | | 395 | .It Ic -ls |
396 | This primary always evaluates to true. | | 396 | This primary always evaluates to true. |
397 | The following information for the current file is written to standard output: | | 397 | The following information for the current file is written to standard output: |
398 | its inode number, size in 512-byte blocks, file permissions, number of hard | | 398 | its inode number, size in 512-byte blocks, file permissions, number of hard |
399 | links, owner, group, size in bytes, last modification time, and pathname. | | 399 | links, owner, group, size in bytes, last modification time, and pathname. |
400 | If the file is a block or character special file, the major and minor numbers | | 400 | If the file is a block or character special file, the major and minor numbers |
401 | will be displayed instead of the size in bytes. | | 401 | will be displayed instead of the size in bytes. |
402 | If the file is a symbolic link, the pathname of the linked-to file will be | | 402 | If the file is a symbolic link, the pathname of the linked-to file will be |
403 | displayed preceded by | | 403 | displayed preceded by |
404 | .Dq -\*[Gt] . | | 404 | .Dq -\*[Gt] . |
405 | The format is identical to that produced by | | 405 | The 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 |
408 | True if the current search depth is less than or equal to what is specified in | | 408 | True 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 |
411 | True if the current search depth is at least what is specified in | | 411 | True 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 |
414 | True if the difference between the file last modification time and the time | | 414 | True if the difference between the file last modification time and the time |
415 | .Nm | | 415 | .Nm |
416 | was started, rounded up to the next full minute, is | | 416 | was started, rounded up to the next full minute, is |
417 | .Ar n | | 417 | .Ar n |
418 | minutes. | | 418 | minutes. |
419 | .It Ic -mtime Ar n | | 419 | .It Ic -mtime Ar n |
420 | True if the difference between the file last modification time and the time | | 420 | True if the difference between the file last modification time and the time |
421 | .Nm | | 421 | .Nm |
422 | was started, rounded up to the next full 24-hour period, is | | 422 | was started, rounded up to the next full 24-hour period, is |
423 | .Ar n | | 423 | .Ar n |
424 | 24-hour periods. | | 424 | 24-hour periods. |
425 | .It Ic -ok Ar utility Oo argument ... Oc No ; | | 425 | .It Ic -ok Ar utility Oo argument ... Oc No ; |
426 | The | | 426 | The |
427 | .Ic -ok | | 427 | .Ic -ok |
428 | primary is similar to the semicolon-terminated | | 428 | primary is similar to the semicolon-terminated |
429 | .Pq Dq \&; | | 429 | .Pq Dq \&; |
430 | variant of the | | 430 | variant of the |
431 | .Ic -exec | | 431 | .Ic -exec |
432 | primary, with the exception that | | 432 | primary, with the exception that |
433 | .Nm | | 433 | .Nm |
434 | requests user affirmation for the execution of the utility by printing | | 434 | requests user affirmation for the execution of the utility by printing |
435 | a message to the terminal and reading a response. | | 435 | a message to the terminal and reading a response. |
436 | If the response is other than | | 436 | If the response is other than |
437 | .Dq y , | | 437 | .Dq y , |
438 | the command is not executed and the | | 438 | the command is not executed and the |
439 | .Ar -ok | | 439 | .Ar -ok |
440 | primary evaluates to false. | | 440 | primary evaluates to false. |
441 | Set aggregation | | 441 | Set aggregation |
442 | .Pq Do \&+ Dc termination | | 442 | .Pq Do \&+ Dc termination |
443 | is not supported. | | 443 | is not supported. |
444 | .It Ic -name Ar pattern | | 444 | .It Ic -name Ar pattern |
445 | True if the last component of the pathname being examined matches | | 445 | True if the last component of the pathname being examined matches |
446 | .Ar pattern . | | 446 | .Ar pattern . |
447 | Special shell pattern matching characters | | 447 | Special 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 |
454 | may be used as part of | | 454 | may be used as part of |
455 | .Ar pattern . | | 455 | .Ar pattern . |
456 | These characters may be matched explicitly by escaping them with a | | 456 | These characters may be matched explicitly by escaping them with a |
457 | backslash | | 457 | backslash |
458 | .Pq Dq \e . | | 458 | .Pq Dq \e . |
459 | .It Ic -newer Ar file | | 459 | .It Ic -newer Ar file |
460 | True if the current file has a more recent last modification time than | | 460 | True 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 |
463 | True if the file belongs to an unknown user. | | 463 | True if the file belongs to an unknown user. |
464 | .It Ic -nogroup | | 464 | .It Ic -nogroup |
465 | True if the file belongs to an unknown group. | | 465 | True if the file belongs to an unknown group. |
466 | .It Ic -path Ar pattern | | 466 | .It Ic -path Ar pattern |
467 | True if the pathname being examined matches | | 467 | True if the pathname being examined matches |
468 | .Ar pattern . | | 468 | .Ar pattern . |
469 | Special shell pattern matching characters | | 469 | Special shell pattern matching characters |
470 | .Po | | 470 | .Po |
471 | .Dq \&[ , | | 471 | .Dq \&[ , |
472 | .Dq \&] , | | 472 | .Dq \&] , |
473 | .Dq \&* , | | 473 | .Dq \&* , |
474 | and | | 474 | and |
475 | .Dq \&? | | 475 | .Dq \&? |
476 | .Pc | | 476 | .Pc |
477 | may be used as part of | | 477 | may be used as part of |
478 | .Ar pattern . | | 478 | .Ar pattern . |
479 | These characters may be matched explicitly by escaping them with a | | 479 | These characters may be matched explicitly by escaping them with a |
480 | backslash | | 480 | backslash |
481 | .Pq Dq \e . | | 481 | .Pq Dq \e . |
482 | Slashes | | 482 | Slashes |
483 | .Pq Dq / | | 483 | .Pq Dq / |
484 | are treated as normal characters and do not have to be | | 484 | are treated as normal characters and do not have to be |
485 | matched explicitly. | | 485 | matched explicitly. |
486 | .It Ic -perm Oo Fl Oc Ns Ar mode | | 486 | .It Ic -perm Oo Fl Oc Ns Ar mode |
487 | The | | 487 | The |
488 | .Ar mode | | 488 | .Ar mode |
489 | may be either symbolic (see | | 489 | may be either symbolic (see |
490 | .Xr chmod 1 ) | | 490 | .Xr chmod 1 ) |
491 | or an octal number. | | 491 | or an octal number. |
492 | If the mode is symbolic, a starting value of zero is assumed and the | | 492 | If the mode is symbolic, a starting value of zero is assumed and the |
493 | mode sets or clears permissions without regard to the process' file mode | | 493 | mode sets or clears permissions without regard to the process' file mode |
494 | creation mask. | | 494 | creation mask. |
495 | If the mode is octal, only bits 07777 | | 495 | If 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 ) |
507 | of the file's mode bits participate | | 507 | of the file's mode bits participate |
508 | in the comparison. | | 508 | in the comparison. |
509 | If the mode is preceded by a dash | | 509 | If the mode is preceded by a dash |
510 | .Pq Dq - , | | 510 | .Pq Dq - , |
511 | this primary evaluates to true | | 511 | this primary evaluates to true |
512 | if at least all of the bits in the mode are set in the file's mode bits. | | 512 | if at least all of the bits in the mode are set in the file's mode bits. |
513 | If the mode is not preceded by a dash, this primary evaluates to true if | | 513 | If the mode is not preceded by a dash, this primary evaluates to true if |
514 | the bits in the mode exactly match the file's mode bits. | | 514 | the bits in the mode exactly match the file's mode bits. |
515 | Note, the first character of a symbolic mode may not be a dash | | 515 | Note, 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 |
518 | This primary always evaluates to true. | | 518 | This primary always evaluates to true. |
519 | It prints the pathname of the current file to standard output, followed | | 519 | It prints the pathname of the current file to standard output, followed |
520 | by a newline character. | | 520 | by a newline character. |
521 | If none of | | 521 | If 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 , |
528 | nor | | 528 | nor |
529 | .Ic -printx | | 529 | .Ic -printx |
530 | is specified, the given expression shall be effectively replaced by | | 530 | is 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 |
534 | This primary always evaluates to true. | | 534 | This primary always evaluates to true. |
535 | It prints the pathname of the current file to standard output, followed | | 535 | It prints the pathname of the current file to standard output, followed |
536 | by a null character. | | 536 | by a null character. |
537 | .It Ic -printx | | 537 | .It Ic -printx |
538 | This primary always evaluates to true. | | 538 | This primary always evaluates to true. |
539 | It prints the pathname of the current file to standard output, | | 539 | It prints the pathname of the current file to standard output, |
540 | with each space, tab, newline, backslash, dollar sign, and single, | | 540 | with each space, tab, newline, backslash, dollar sign, and single, |
541 | double, or back quotation mark prefixed by a backslash, so the output of | | 541 | double, or back quotation mark prefixed by a backslash, so the output of |
542 | .Nm find | | 542 | .Nm find |
543 | can safely be used as input to | | 543 | can safely be used as input to |
544 | .Nm xargs . | | 544 | .Nm xargs . |
545 | .It Ic -prune | | 545 | .It Ic -prune |
546 | This primary always evaluates to true. | | 546 | This primary always evaluates to true. |
547 | It causes | | 547 | It causes |
548 | .Nm | | 548 | .Nm |
549 | to not descend into the current file. | | 549 | to not descend into the current file. |
550 | Note, the | | 550 | Note, the |
551 | .Ic -prune | | 551 | .Ic -prune |
552 | primary has no effect if the | | 552 | primary has no effect if the |
553 | .Fl d | | 553 | .Fl d |
554 | option was specified. | | 554 | option was specified. |
555 | .It Ic -regex Ar regexp | | 555 | .It Ic -regex Ar regexp |
556 | True if the path name of the current file matches the case-sensitive | | 556 | True if the path name of the current file matches the case-sensitive |
557 | basic regular expression | | 557 | basic regular expression |
558 | .Pq see Xr re_format 7 | | 558 | .Pq see Xr re_format 7 |
559 | .Ar regexp . | | 559 | .Ar regexp . |
560 | This is a match on the whole path, not a search for the regular expression | | 560 | This is a match on the whole path, not a search for the regular expression |
561 | within the path. | | 561 | within the path. |
562 | .It Ic -size Ar n Ns Op Cm c | | 562 | .It Ic -size Ar n Ns Op Cm c |
563 | True if the file's size, rounded up, in 512-byte blocks is | | 563 | True if the file's size, rounded up, in 512-byte blocks is |
564 | .Ar n . | | 564 | .Ar n . |
565 | If | | 565 | If |
566 | .Ar n | | 566 | .Ar n |
567 | is followed by a | | 567 | is followed by a |
568 | .Dq c , | | 568 | .Dq c , |
569 | then the primary is true if the file's size is | | 569 | then the primary is true if the file's size is |
570 | .Ar n | | 570 | .Ar n |
571 | bytes. | | 571 | bytes. |
572 | .It Ic -type Ar t | | 572 | .It Ic -type Ar t |
573 | True if the file is of the specified type. | | 573 | True if the file is of the specified type. |
574 | Possible file types are as follows: | | 574 | Possible 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 |
578 | block special | | 578 | block special |
579 | .It Cm c | | 579 | .It Cm c |
580 | character special | | 580 | character special |
581 | .It Cm d | | 581 | .It Cm d |
582 | directory | | 582 | directory |
583 | .It Cm f | | 583 | .It Cm f |
584 | regular file | | 584 | regular file |
585 | .It Cm l | | 585 | .It Cm l |
586 | symbolic link | | 586 | symbolic link |
587 | .It Cm p | | 587 | .It Cm p |
588 | FIFO | | 588 | FIFO |
589 | .It Cm s | | 589 | .It Cm s |
590 | socket | | 590 | socket |
591 | .It Cm W | | 591 | .It Cm W |
592 | whiteout | | 592 | whiteout |
593 | .It Cm w | | 593 | .It Cm w |
594 | whiteout | | 594 | whiteout |
595 | .El | | 595 | .El |
596 | .Pp | | 596 | .Pp |
597 | .It Ic -user Ar uname | | 597 | .It Ic -user Ar uname |
598 | True if the file belongs to the user | | 598 | True if the file belongs to the user |
599 | .Ar uname . | | 599 | .Ar uname . |
600 | If | | 600 | If |
601 | .Ar uname | | 601 | .Ar uname |
602 | is numeric and there is no such user name, then | | 602 | is numeric and there is no such user name, then |
603 | .Ar uname | | 603 | .Ar uname |
604 | is treated as a user id (and considered a numeric argument). | | 604 | is treated as a user id (and considered a numeric argument). |
605 | .It Ic -xdev | | 605 | .It Ic -xdev |
606 | This primary always evaluates to true. | | 606 | This primary always evaluates to true. |
607 | It causes find not to descend past directories that have a different | | 607 | It causes find not to descend past directories that have a different |
608 | device ID (st_dev, see | | 608 | device ID (st_dev, see |
609 | .Xr stat 2 | | 609 | .Xr stat 2 |
610 | S5.6.2 [POSIX.1]). | | 610 | S5.6.2 [POSIX.1]). |
611 | .El | | 611 | .El |
612 | .Pp | | 612 | .Pp |
613 | All primaries which take a numeric argument allow the number to be | | 613 | All primaries which take a numeric argument allow the number to be |
614 | preceded by a plus sign | | 614 | preceded by a plus sign |
615 | .Pq Dq + | | 615 | .Pq Dq + |
616 | or a minus sign | | 616 | or a minus sign |
617 | .Pq Dq \- . | | 617 | .Pq Dq \- . |
618 | A preceding plus sign means | | 618 | A preceding plus sign means |
619 | .Dq more than n , | | 619 | .Dq more than n , |
620 | a preceding minus sign means | | 620 | a preceding minus sign means |
621 | .Dq less than n , | | 621 | .Dq less than n , |
622 | and neither means | | 622 | and neither means |
623 | .Dq exactly n . | | 623 | .Dq exactly n . |
624 | .Sh OPERATORS | | 624 | .Sh OPERATORS |
625 | The primaries may be combined using the following operators. | | 625 | The primaries may be combined using the following operators. |
626 | The operators are listed in order of decreasing precedence. | | 626 | The 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 \&) |
629 | This evaluates to true if the parenthesized expression evaluates to | | 629 | This evaluates to true if the parenthesized expression evaluates to |
630 | true. | | 630 | true. |
631 | .Pp | | 631 | .Pp |
632 | .It Cm \&! Ar expression | | 632 | .It Cm \&! Ar expression |
633 | This is the unary | | 633 | This is the unary |
634 | .Tn NOT | | 634 | .Tn NOT |
635 | operator. | | 635 | operator. |
636 | It evaluates to true if the expression is false. | | 636 | It 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 |
640 | The | | 640 | The |
641 | .Cm -and | | 641 | .Cm -and |
642 | operator is the logical | | 642 | operator is the logical |
643 | .Tn AND | | 643 | .Tn AND |
644 | operator. | | 644 | operator. |
645 | As it is implied by the juxtaposition of two expressions it does not | | 645 | As it is implied by the juxtaposition of two expressions it does not |
646 | have to be specified. | | 646 | have to be specified. |
647 | The expression evaluates to true if both expressions are true. | | 647 | The expression evaluates to true if both expressions are true. |
648 | The second expression is not evaluated if the first expression is false. | | 648 | The 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 |
651 | The | | 651 | The |
652 | .Cm -or | | 652 | .Cm -or |
653 | operator is the logical | | 653 | operator is the logical |
654 | .Tn OR | | 654 | .Tn OR |
655 | operator. | | 655 | operator. |
656 | The expression evaluates to true if either the first or the second expression | | 656 | The expression evaluates to true if either the first or the second expression |
657 | is true. | | 657 | is true. |
658 | The second expression is not evaluated if the first expression is true. | | 658 | The second expression is not evaluated if the first expression is true. |
659 | .El | | 659 | .El |
660 | .Pp | | 660 | .Pp |
661 | All operands and primaries must be separate arguments to | | 661 | All operands and primaries must be separate arguments to |
662 | .Nm . | | 662 | .Nm . |
663 | Primaries which themselves take arguments expect each argument | | 663 | Primaries which themselves take arguments expect each argument |
664 | to be a separate argument to | | 664 | to be a separate argument to |
665 | .Nm . | | 665 | .Nm . |
666 | .Sh EXIT STATUS | | 666 | .Sh EXIT STATUS |
667 | The | | 667 | The |
668 | .Nm | | 668 | .Nm |
669 | utility normally exits 0 on success, and exits with 1 under certain | | 669 | utility normally exits 0 on success, and exits with 1 under certain |
670 | internal error conditions. | | 670 | internal error conditions. |
671 | If any invokations of | | 671 | If any invokations of |
672 | .Dq Ic -exec Ar ... No + | | 672 | .Dq Ic -exec Ar ... No + |
673 | primaries return non-zero exit-status, then | | 673 | primaries return non-zero exit-status, then |
674 | .Nm | | 674 | .Nm |
675 | will do so as well. | | 675 | will do so as well. |
676 | .Sh EXAMPLES | | 676 | .Sh EXAMPLES |
677 | The following examples are shown as given to the shell: | | 677 | The 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" |
680 | Print out a list of all the files whose names do not end in | | 680 | Print 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" |
683 | Print out a list of all the files owned by user | | 683 | Print out a list of all the files owned by user |
684 | .Dq wnj | | 684 | .Dq wnj |
685 | that are newer than the file | | 685 | that 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" |
688 | Print out a list of all the files which are not both newer than | | 688 | Print out a list of all the files which are not both newer than |
689 | .Dq ttt | | 689 | .Dq ttt |
690 | and owned by | | 690 | and 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" |
693 | Print out a list of all the files that are either owned by | | 693 | Print out a list of all the files that are either owned by |
694 | .Dq wnj | | 694 | .Dq wnj |
695 | or that are newer than | | 695 | or 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" |
698 | Return immediately with a value of 1 if any files are found that are either | | 698 | Return immediately with a value of 1 if any files are found that are either |
699 | owned by | | 699 | owned by |
700 | .Dq wnj | | 700 | .Dq wnj |
701 | or that are newer than | | 701 | or that are newer than |
702 | .Dq ttt , | | 702 | .Dq ttt , |
703 | but do not print them. | | 703 | but 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" |
705 | Same as above, but list the first file matching the criteria before exiting | | 705 | Same as above, but list the first file matching the criteria before exiting |
706 | with a value of 1. | | 706 | with 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 |
721 | The | | 721 | The |
722 | .Nm | | 722 | .Nm |
723 | utility syntax is a superset of the syntax specified by the | | 723 | utility syntax is a superset of the syntax specified by the |
724 | .St -p1003.2 | | 724 | .St -p1003.2 |
725 | standard. | | 725 | standard. |
726 | .Pp | | 726 | .Pp |
727 | The options and the | | 727 | The 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 , |
749 | and | | 749 | and |
750 | .Ic -rm | | 750 | .Ic -rm |
751 | primaries are extensions to | | 751 | primaries are extensions to |
752 | .St -p1003.2 . | | 752 | .St -p1003.2 . |
753 | .Pp | | 753 | .Pp |
754 | Historically, the | | 754 | Historically, the |
755 | .Fl d , | | 755 | .Fl d , |
756 | .Fl h , | | 756 | .Fl h , |
757 | and | | 757 | and |
758 | .Fl x | | 758 | .Fl x |
759 | options were implemented using the primaries | | 759 | options were implemented using the primaries |
760 | .Dq -depth , | | 760 | .Dq -depth , |
761 | .Dq -follow , | | 761 | .Dq -follow , |
762 | and | | 762 | and |
763 | .Dq -xdev . | | 763 | .Dq -xdev . |
764 | These primaries always evaluated to true. | | 764 | These primaries always evaluated to true. |
765 | As they were really global variables that took effect before the traversal | | 765 | As they were really global variables that took effect before the traversal |
766 | began, some legal expressions could have unexpected results. | | 766 | began, some legal expressions could have unexpected results. |
767 | An example is the expression | | 767 | An example is the expression |
768 | .Dq -print -o -depth . | | 768 | .Dq -print -o -depth . |
769 | As -print always evaluates to true, the standard order of evaluation | | 769 | As -print always evaluates to true, the standard order of evaluation |
770 | implies that -depth would never be evaluated. | | 770 | implies that -depth would never be evaluated. |
771 | This is not the case. | | 771 | This is not the case. |
772 | .Pp | | 772 | .Pp |
773 | The operator | | 773 | The operator |
774 | .Dq -or | | 774 | .Dq -or |
775 | was implemented as | | 775 | was implemented as |
776 | .Dq -o , | | 776 | .Dq -o , |
777 | and the operator | | 777 | and the operator |
778 | .Dq -and | | 778 | .Dq -and |
779 | was implemented as | | 779 | was implemented as |
780 | .Dq -a . | | 780 | .Dq -a . |
781 | .Pp | | 781 | .Pp |
782 | Historic implementations of the | | 782 | Historic implementations of the |
783 | .Ic -exec | | 783 | .Ic -exec |
784 | and | | 784 | and |
785 | .Ic -ok | | 785 | .Ic -ok |
786 | primaries did not replace the string | | 786 | primaries did not replace the string |
787 | .Dq {} | | 787 | .Dq {} |
788 | in the utility name or the | | 788 | in the utility name or the |
789 | utility arguments if it had preceding or following non-whitespace characters. | | 789 | utility arguments if it had preceding or following non-whitespace characters. |
790 | This version replaces it no matter where in the utility name or arguments | | 790 | This version replaces it no matter where in the utility name or arguments |
791 | it appears. | | 791 | it appears. |
792 | .Pp | | 792 | .Pp |
793 | Support for | | 793 | Support for |
794 | .Dq Ic -exec Ar ... No + | | 794 | .Dq Ic -exec Ar ... No + |
795 | is consistent with | | 795 | is consistent with |
796 | .Em IEEE PASC Interpretation 1003.2 #210 , | | 796 | .Em IEEE PASC Interpretation 1003.2 #210 , |
797 | though the feature originated in | | 797 | though the feature originated in |
798 | .Tn SVR4 . | | 798 | .Tn SVR4 . |
799 | .Pp | | 799 | .Pp |
800 | The | | 800 | The |
801 | .Ic -delete | | 801 | .Ic -delete |
802 | primary does not interact well with other options that cause the filesystem | | 802 | primary does not interact well with other options that cause the filesystem |
803 | tree traversal options to be changed. | | 803 | tree traversal options to be changed. |
804 | .Sh HISTORY | | 804 | .Sh HISTORY |
805 | A much simpler | | 805 | A much simpler |
806 | .Nm find | | 806 | .Nm find |
807 | command appeared in First Edition AT\*[Am]T Unix. | | 807 | command appeared in First Edition AT\*[Am]T Unix. |
808 | The syntax had become similar to the present version by | | 808 | The syntax had become similar to the present version by |
809 | the time of the Fifth Edition. | | 809 | the time of the Fifth Edition. |
810 | .Sh BUGS | | 810 | .Sh BUGS |
811 | The special characters used by | | 811 | The special characters used by |
812 | .Nm | | 812 | .Nm |
813 | are also special characters to many shell programs. | | 813 | are also special characters to many shell programs. |
814 | In particular, the characters | | 814 | In 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 , |
823 | and | | 823 | and |
824 | .Dq \&; | | 824 | .Dq \&; |
825 | may have to be escaped from the shell. | | 825 | may have to be escaped from the shell. |
826 | .Pp | | 826 | .Pp |
827 | As there is no delimiter separating options and file names or file | | 827 | As there is no delimiter separating options and file names or file |
828 | names and the | | 828 | names and the |
829 | .Ar expression , | | 829 | .Ar expression , |
830 | it is difficult to specify files named | | 830 | it is difficult to specify files named |
831 | .Dq -xdev | | 831 | .Dq -xdev |
832 | or | | 832 | or |
833 | .Dq \&! . | | 833 | .Dq \&! . |
834 | These problems are handled by the | | 834 | These problems are handled by the |
835 | .Fl f | | 835 | .Fl f |
836 | option and the | | 836 | option and the |
837 | .Xr getopt 3 | | 837 | .Xr getopt 3 |
838 | .Dq -- | | 838 | .Dq -- |
839 | construct. | | 839 | construct. |