| @@ -1,974 +1,977 @@ | | | @@ -1,974 +1,977 @@ |
1 | .\" $NetBSD: find.1,v 1.89 2017/07/03 21:34:57 wiz Exp $ | | 1 | .\" $NetBSD: find.1,v 1.90 2020/11/01 16:34:02 kim 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 June 13, 2016 | | 35 | .Dd June 13, 2016 |
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 | .Bl -tag -width Ds | | 68 | .Bl -tag -width Ds |
69 | .It Fl H | | 69 | .It Fl H |
70 | Causes the file information and file type (see | | 70 | Causes the file information and file type (see |
71 | .Xr stat 2 ) | | 71 | .Xr stat 2 ) |
72 | returned for each symbolic link encountered on the command line to be | | 72 | returned for each symbolic link encountered on the command line to be |
73 | those of the file referenced by the link, not the link itself. | | 73 | those of the file referenced by the link, not the link itself. |
74 | If the referenced file does not exist, the file information and type will | | 74 | If the referenced file does not exist, the file information and type will |
75 | be for the link itself. | | 75 | be for the link itself. |
76 | File information of all symbolic links not on the command line is that | | 76 | File information of all symbolic links not on the command line is that |
77 | of the link itself. | | 77 | of the link itself. |
78 | .It Fl L | | 78 | .It Fl L |
79 | Causes the file information and file type (see | | 79 | Causes the file information and file type (see |
80 | .Xr stat 2 ) | | 80 | .Xr stat 2 ) |
81 | returned for each symbolic link to be those of the file referenced by the | | 81 | returned for each symbolic link to be those of the file referenced by the |
82 | link, not the link itself. | | 82 | link, not the link itself. |
83 | If the referenced file does not exist, the file information and type will | | 83 | If the referenced file does not exist, the file information and type will |
84 | be for the link itself. | | 84 | be for the link itself. |
85 | .It Fl P | | 85 | .It Fl P |
86 | Causes the file information and file type (see | | 86 | Causes the file information and file type (see |
87 | .Xr stat 2 ) | | 87 | .Xr stat 2 ) |
88 | returned for each symbolic link to be those of the link itself. | | 88 | returned for each symbolic link to be those of the link itself. |
89 | .It Fl d | | 89 | .It Fl d |
90 | Causes | | 90 | Causes |
91 | .Nm | | 91 | .Nm |
92 | to perform a depth-first traversal, i.e., directories | | 92 | to perform a depth-first traversal, i.e., directories |
93 | are visited in post-order, and all entries in a directory will be acted | | 93 | are visited in post-order, and all entries in a directory will be acted |
94 | on before the directory itself. | | 94 | on before the directory itself. |
95 | By default, | | 95 | By default, |
96 | .Nm | | 96 | .Nm |
97 | visits directories in pre-order, i.e., before their contents. | | 97 | visits directories in pre-order, i.e., before their contents. |
98 | Note, the default is | | 98 | Note, the default is |
99 | .Em not | | 99 | .Em not |
100 | a breadth-first traversal. | | 100 | a breadth-first traversal. |
101 | .It Fl E | | 101 | .It Fl E |
102 | Causes | | 102 | Causes |
103 | .Ar regexp | | 103 | .Ar regexp |
104 | arguments to primaries to be interpreted as extended regular | | 104 | arguments to primaries to be interpreted as extended regular |
105 | expressions (see | | 105 | expressions (see |
106 | .Xr re_format 7 ) . | | 106 | .Xr re_format 7 ) . |
107 | .It Fl f | | 107 | .It Fl f |
108 | Specifies a file hierarchy for | | 108 | Specifies a file hierarchy for |
109 | .Nm | | 109 | .Nm |
110 | to traverse. | | 110 | to traverse. |
111 | File hierarchies may also be specified as the operands immediately | | 111 | File hierarchies may also be specified as the operands immediately |
112 | following the options. | | 112 | following the options. |
113 | .It Fl h | | 113 | .It Fl h |
114 | Causes the file information and file type (see | | 114 | Causes the file information and file type (see |
115 | .Xr stat 2 ) | | 115 | .Xr stat 2 ) |
116 | returned for each symbolic link to be those of the file referenced by the | | 116 | returned for each symbolic link to be those of the file referenced by the |
117 | link, not the link itself. | | 117 | link, not the link itself. |
118 | If the referenced file does not exist, the file information and type will | | 118 | If the referenced file does not exist, the file information and type will |
119 | be for the link itself. | | 119 | be for the link itself. |
120 | .It Fl s | | 120 | .It Fl s |
121 | Causes the entries of each directory to be sorted in | | 121 | Causes the entries of each directory to be sorted in |
122 | lexicographical order. | | 122 | lexicographical order. |
123 | Note that the sorting is done only inside of each directory; | | 123 | Note that the sorting is done only inside of each directory; |
124 | files in different directories are not sorted. | | 124 | files in different directories are not sorted. |
125 | Therefore, | | 125 | Therefore, |
126 | .Sq Li a/b | | 126 | .Sq Li a/b |
127 | appears before | | 127 | appears before |
128 | .Sq Li a.b , | | 128 | .Sq Li a.b , |
129 | which is different from | | 129 | which is different from |
130 | .Dq Li "find ... \&| sort" | | 130 | .Dq Li "find ... \&| sort" |
131 | order. | | 131 | order. |
132 | .It Fl X | | 132 | .It Fl X |
133 | Modifies the output to permit | | 133 | Modifies the output to permit |
134 | .Nm | | 134 | .Nm |
135 | to be safely used in conjunction with | | 135 | to be safely used in conjunction with |
136 | .Xr xargs 1 . | | 136 | .Xr xargs 1 . |
137 | If a file name contains any of the delimiting characters used by | | 137 | If a file name contains any of the delimiting characters used by |
138 | .Xr xargs 1 , | | 138 | .Xr xargs 1 , |
139 | a diagnostic message is displayed on standard error, and the file | | 139 | a diagnostic message is displayed on standard error, and the file |
140 | is skipped. | | 140 | is skipped. |
141 | The delimiting characters include single | | 141 | The delimiting characters include single |
142 | .Pq Dq \&' | | 142 | .Pq Dq \&' |
143 | and double | | 143 | and double |
144 | .Pq Dq \&" | | 144 | .Pq Dq \&" |
145 | quotes, backslash | | 145 | quotes, backslash |
146 | .Pq Dq \e , | | 146 | .Pq Dq \e , |
147 | space, tab, and newline characters. | | 147 | space, tab, and newline characters. |
148 | Alternatively, the | | 148 | Alternatively, the |
149 | .Ic -print0 | | 149 | .Ic -print0 |
150 | or | | 150 | or |
151 | .Ic -printx | | 151 | .Ic -printx |
152 | primaries can be used to format the output in a way that | | 152 | primaries can be used to format the output in a way that |
153 | .Xr xargs 1 | | 153 | .Xr xargs 1 |
154 | can accept. | | 154 | can accept. |
155 | .It Fl x | | 155 | .It Fl x |
156 | Restricts the search to the file system containing the | | 156 | Restricts the search to the file system containing the |
157 | directory specified. | | 157 | directory specified. |
158 | Does not list mount points to other file systems. | | 158 | Does not list mount points to other file systems. |
159 | .El | | 159 | .El |
160 | .Sh PRIMARIES | | 160 | .Sh PRIMARIES |
161 | All primaries which take a numeric argument of | | 161 | All primaries which take a numeric argument of |
162 | .Ar n | | 162 | .Ar n |
163 | allow the number to be preceded by a plus sign | | 163 | allow the number to be preceded by a plus sign |
164 | .Pq Dq \&+ | | 164 | .Pq Dq \&+ |
165 | or a minus sign | | 165 | or a minus sign |
166 | .Pq Dq \- . | | 166 | .Pq Dq \- . |
167 | A preceding plus sign means | | 167 | A preceding plus sign means |
168 | .Dq more than Ar n , | | 168 | .Dq more than Ar n , |
169 | a preceding minus sign means | | 169 | a preceding minus sign means |
170 | .Dq less than Ar n , | | 170 | .Dq less than Ar n , |
171 | and neither means | | 171 | and neither means |
172 | .Dq exactly Ar n . | | 172 | .Dq exactly Ar n . |
173 | (The argument specified for the | | 173 | (The argument specified for the |
174 | .Ic -user | | 174 | .Ic -user |
175 | and | | 175 | and |
176 | .Ic -group | | 176 | .Ic -group |
177 | primaries | | 177 | primaries |
178 | are similarly treated if the value is numeric and does not correspond to a | | 178 | are similarly treated if the value is numeric and does not correspond to a |
179 | valid user or group name.) | | 179 | valid user or group name.) |
180 | .Pp | | 180 | .Pp |
181 | For primaries which take a | | 181 | For primaries which take a |
182 | .Ar timestamp | | 182 | .Ar timestamp |
183 | argument, the argument must be valid input to | | 183 | argument, the argument must be valid input to |
184 | .Xr parsedate 3 . | | 184 | .Xr parsedate 3 . |
185 | If the argument contains multiple words, enclose the argument in quotes. | | 185 | If the argument contains multiple words, enclose the argument in quotes. |
186 | .Pp | | 186 | .Pp |
187 | .Bl -tag -width Ds -compact | | 187 | .Bl -tag -width Ds -compact |
188 | .It Ic -amin Ar n | | 188 | .It Ic -amin Ar n |
189 | True if the difference between the file last access time and the time | | 189 | True if the difference between the file last access time and the time |
190 | .Nm | | 190 | .Nm |
191 | was started, rounded up to the next full minute, is | | 191 | was started, rounded up to the next full minute, is |
192 | .Ar n | | 192 | .Ar n |
193 | minutes. | | 193 | minutes. |
194 | .Pp | | 194 | .Pp |
195 | .It Ic -anewer Ar file | | 195 | .It Ic -anewer Ar file |
196 | True if the current file has a more recent last access time than | | 196 | True if the current file has a more recent last access time than |
197 | .Ar file . | | 197 | .Ar file . |
198 | .Pp | | 198 | .Pp |
199 | .It Ic -asince Ar timestamp | | 199 | .It Ic -asince Ar timestamp |
200 | True if the file last access time is greater than the specified | | 200 | True if the file last access time is greater than the specified |
201 | .Ar timestamp . | | 201 | .Ar timestamp . |
202 | .Pp | | 202 | .Pp |
203 | .It Ic -atime Ar n | | 203 | .It Ic -atime Ar n |
204 | True if the difference between the file last access time and the time | | 204 | True if the difference between the file last access time and the time |
205 | .Nm | | 205 | .Nm |
206 | was started, rounded up to the next full 24-hour period, is | | 206 | was started, rounded up to the next full 24-hour period, is |
207 | .Ar n | | 207 | .Ar n |
208 | 24-hour periods. | | 208 | 24-hour periods. |
209 | .Pp | | 209 | .Pp |
210 | .It Ic -cmin Ar n | | 210 | .It Ic -cmin Ar n |
211 | True if the difference between the time of last change of file status | | 211 | True if the difference between the time of last change of file status |
212 | information and the time | | 212 | information and the time |
213 | .Nm | | 213 | .Nm |
214 | was started, rounded up to the next full minute, is | | 214 | was started, rounded up to the next full minute, is |
215 | .Ar n | | 215 | .Ar n |
216 | minutes. | | 216 | minutes. |
217 | .Pp | | 217 | .Pp |
218 | .It Ic -cnewer Ar file | | 218 | .It Ic -cnewer Ar file |
219 | True if the current file has a more recent last change time than | | 219 | True if the current file has a more recent last change time than |
220 | .Ar file . | | 220 | .Ar file . |
221 | .Pp | | 221 | .Pp |
222 | .It Ic -csince Ar timestamp | | 222 | .It Ic -csince Ar timestamp |
223 | True if the file last status change time is greater than the specified | | 223 | True if the file last status change time is greater than the specified |
224 | .Ar timestamp . | | 224 | .Ar timestamp . |
225 | .Pp | | 225 | .Pp |
226 | .It Ic -ctime Ar n | | 226 | .It Ic -ctime Ar n |
227 | True if the difference between the time of last change of file status | | 227 | True if the difference between the time of last change of file status |
228 | information and the time | | 228 | information and the time |
229 | .Nm | | 229 | .Nm |
230 | was started, rounded up to the next full 24-hour period, is | | 230 | was started, rounded up to the next full 24-hour period, is |
231 | .Ar n | | 231 | .Ar n |
232 | 24-hour periods. | | 232 | 24-hour periods. |
233 | .Pp | | 233 | .Pp |
234 | .It Ic -delete | | 234 | .It Ic -delete |
235 | Delete found files, symbolic links, and directories. | | 235 | Delete found files, symbolic links, and directories. |
236 | Always returns true. | | 236 | Always returns true. |
237 | This executes from the current working directory as | | 237 | This executes from the current working directory as |
238 | .Nm | | 238 | .Nm |
239 | recurses down the tree. | | 239 | recurses down the tree. |
240 | To avoid deleting unexpected files, it will ignore any filenames that | | 240 | To avoid deleting unexpected files, it will ignore any filenames that |
241 | .Xr fts 3 | | 241 | .Xr fts 3 |
242 | returns that contain a | | 242 | returns that contain a |
243 | .Dq / | | 243 | .Dq / |
244 | .Xr ( fts 3 | | 244 | .Xr ( fts 3 |
245 | should not return such pathnames). | | 245 | should not return such pathnames). |
246 | Depth-first traversal processing is implied by this option. | | 246 | Depth-first traversal processing is implied by this option. |
247 | This primary can also be invoked as | | 247 | This primary can also be invoked as |
248 | .Ic -rm . | | 248 | .Ic -rm . |
249 | .Pp | | 249 | .Pp |
250 | .It Ic -empty | | 250 | .It Ic -empty |
251 | True if the current file or directory is empty. | | 251 | True if the current file or directory is empty. |
252 | .Pp | | 252 | .Pp |
253 | .It Ic -exec Ar utility Oo argument ... Oc Ic \&; | | 253 | .It Ic -exec Ar utility Oo argument ... Oc Ic \&; |
254 | .It Ic -exec Ar utility Oo argument ... Oc Ic {} Ic \&+ | | 254 | .It Ic -exec Ar utility Oo argument ... Oc Ic {} Ic \&+ |
255 | Execute the specified | | 255 | Execute the specified |
256 | .Ar utility | | 256 | .Ar utility |
257 | with the specified arguments. | | 257 | with the specified arguments. |
258 | .Pp | | 258 | .Pp |
259 | The list of arguments for | | 259 | The list of arguments for |
260 | .Ar utility | | 260 | .Ar utility |
261 | is terminated by a lone semicolon | | 261 | is terminated by a lone semicolon |
262 | .Dq Ic \&; | | 262 | .Dq Ic \&; |
263 | or plus | | 263 | or plus |
264 | .Dq Ic \&+ | | 264 | .Dq Ic \&+ |
265 | character as a separate parameter. | | 265 | character as a separate parameter. |
266 | The command specified by | | 266 | The command specified by |
267 | .Ar utility | | 267 | .Ar utility |
268 | will be executed with its current working directory being the directory | | 268 | will be executed with its current working directory being the directory |
269 | from which | | 269 | from which |
270 | .Nm | | 270 | .Nm |
271 | was executed. | | 271 | was executed. |
272 | .Pp | | 272 | .Pp |
273 | If the list of arguments is terminated by a semicolon | | 273 | If the list of arguments is terminated by a semicolon |
274 | .Pq Dq Ic \&; , | | 274 | .Pq Dq Ic \&; , |
275 | then | | 275 | then |
276 | .Ar utility | | 276 | .Ar utility |
277 | is invoked once per pathname. | | 277 | is invoked once per pathname. |
278 | If | | 278 | If |
279 | the string | | 279 | the string |
280 | .Dq Ic {} | | 280 | .Dq Ic {} |
281 | appears one or more times in the utility name or arguments, | | 281 | appears one or more times in the utility name or arguments, |
282 | then it is replaced by the pathname of the current file | | 282 | then it is replaced by the pathname of the current file |
283 | (but it need not appear, in which case the pathname | | 283 | (but it need not appear, in which case the pathname |
284 | will not be passed to | | 284 | will not be passed to |
285 | .Ar utility ) . | | 285 | .Ar utility ) . |
286 | The semicolon-terminated form of the | | 286 | The semicolon-terminated form of the |
287 | .Ic -exec | | 287 | .Ic -exec |
288 | primary returns true if and only if | | 288 | primary returns true if and only if |
289 | .Ar utility | | 289 | .Ar utility |
290 | exits with a zero exit status. | | 290 | exits with a zero exit status. |
291 | Note that the semicolon will have to be escaped on the shell command line | | 291 | Note that the semicolon will have to be escaped on the shell command line |
292 | in order to be passed as a parameter. | | 292 | in order to be passed as a parameter. |
293 | .Pp | | 293 | .Pp |
294 | If the list of arguments is terminated by a plus sign | | 294 | If the list of arguments is terminated by a plus sign |
295 | .Pq Dq Ic \&+ , | | 295 | .Pq Dq Ic \&+ , |
296 | then the pathnames for which the primary is evaluated are aggregated | | 296 | then the pathnames for which the primary is evaluated are aggregated |
297 | into sets, and | | 297 | into sets, and |
298 | .Ar utility | | 298 | .Ar utility |
299 | will be invoked once per set, similar to | | 299 | will be invoked once per set, similar to |
300 | .Xr xargs 1 . | | 300 | .Xr xargs 1 . |
301 | In this case the string | | 301 | In this case the string |
302 | .Dq Ic {} | | 302 | .Dq Ic {} |
303 | must appear, and must appear as the last item in the argument list, | | 303 | must appear, and must appear as the last item in the argument list, |
304 | just before the | | 304 | just before the |
305 | .Dq Ic \&+ | | 305 | .Dq Ic \&+ |
306 | parameter, and is replaced by the pathnames of the current set of files. | | 306 | parameter, and is replaced by the pathnames of the current set of files. |
307 | Each set is limited to no more than 5,000 pathnames, | | 307 | Each set is limited to no more than 5,000 pathnames, |
308 | and is also limited such that the total number of bytes in the argument | | 308 | and is also limited such that the total number of bytes in the argument |
309 | list does not exceed | | 309 | list does not exceed |
310 | .Dv ARG_MAX . | | 310 | .Dv ARG_MAX . |
311 | The plus-terminated form of the | | 311 | The plus-terminated form of the |
312 | .Ic -exec | | 312 | .Ic -exec |
313 | primary always returns true. | | 313 | primary always returns true. |
314 | If the plus-terminated form of the | | 314 | If the plus-terminated form of the |
315 | .Ic -exec | | 315 | .Ic -exec |
316 | primary results in any invocation of | | 316 | primary results in any invocation of |
317 | .Ar utility | | 317 | .Ar utility |
318 | exiting with non-zero exit status, then | | 318 | exiting with non-zero exit status, then |
319 | .Nm | | 319 | .Nm |
320 | will eventually exit with non-zero status as well, | | 320 | will eventually exit with non-zero status as well, |
321 | but this does not cause | | 321 | but this does not cause |
322 | .Nm | | 322 | .Nm |
323 | to exit early. | | 323 | to exit early. |
324 | .Pp | | 324 | .Pp |
325 | .It Ic -execdir Ar utility Oo argument ... Oc Ic \&; | | 325 | .It Ic -execdir Ar utility Oo argument ... Oc Ic \&; |
326 | The | | 326 | The |
327 | .Ic -execdir | | 327 | .Ic -execdir |
328 | primary is similar to the semicolon-terminated | | 328 | primary is similar to the semicolon-terminated |
329 | .Pq Dq Ic \&; | | 329 | .Pq Dq Ic \&; |
330 | variant of the | | 330 | variant of the |
331 | .Ic -exec | | 331 | .Ic -exec |
332 | primary, with the exception that | | 332 | primary, with the exception that |
333 | .Ar utility | | 333 | .Ar utility |
334 | will be executed from the directory that holds | | 334 | will be executed from the directory that holds |
335 | the current file. | | 335 | the current file. |
336 | Only the base filename is substituted for the string | | 336 | Only the base filename is substituted for the string |
337 | .Dq Ic {} . | | 337 | .Dq Ic {} . |
338 | Set aggregation | | 338 | Set aggregation |
339 | .Pq Do Ic \&+ Dc termination | | 339 | .Pq Do Ic \&+ Dc termination |
340 | is not supported. | | 340 | is not supported. |
341 | .Pp | | 341 | .Pp |
342 | .It Ic -exit Op Ar status | | 342 | .It Ic -exit Op Ar status |
343 | This primary causes | | 343 | This primary causes |
344 | .Nm | | 344 | .Nm |
345 | to stop traversing the file system and exit immediately, | | 345 | to stop traversing the file system and exit immediately, |
346 | with the specified numeric exit status. | | 346 | with the specified numeric exit status. |
347 | If the | | 347 | If the |
348 | .Ar status | | 348 | .Ar status |
349 | value is not specified, then | | 349 | value is not specified, then |
350 | .Nm | | 350 | .Nm |
351 | will exit with status zero. | | 351 | will exit with status zero. |
352 | Note that any preceding primaries will be evaluated and acted upon | | 352 | Note that any preceding primaries will be evaluated and acted upon |
353 | before exiting. | | 353 | before exiting. |
354 | .Pp | | 354 | .Pp |
355 | .It Ic -false | | 355 | .It Ic -false |
356 | This primary always evaluates to false. | | 356 | This primary always evaluates to false. |
357 | This can be used following a primary that caused the | | 357 | This can be used following a primary that caused the |
358 | expression to be true to make the expression to be false. | | 358 | expression to be true to make the expression to be false. |
359 | This can be useful after using a | | 359 | This can be useful after using a |
360 | .Ic -fprint | | 360 | .Ic -fprint |
361 | primary so it can continue to the next expression (using an | | 361 | primary so it can continue to the next expression (using an |
362 | .Cm -or | | 362 | .Cm -or |
363 | operator, for example). | | 363 | operator, for example). |
364 | .Pp | | 364 | .Pp |
365 | .It Ic -flags Oo Fl Oc Ns Ar flags | | 365 | .It Ic -flags Oo Fl Oc Ns Ar flags |
366 | If | | 366 | If |
367 | .Ar flags | | 367 | .Ar flags |
368 | are preceded by a dash | | 368 | are preceded by a dash |
369 | .Pq Dq Ic \- , | | 369 | .Pq Dq Ic \- , |
370 | this primary evaluates to true | | 370 | this primary evaluates to true |
371 | if at least all of the bits in | | 371 | if at least all of the bits in |
372 | .Ar flags | | 372 | .Ar flags |
373 | are set in the file's flags bits. | | 373 | are set in the file's flags bits. |
374 | If | | 374 | If |
375 | .Ar flags | | 375 | .Ar flags |
376 | are not preceded by a dash, this primary evaluates to true if | | 376 | are not preceded by a dash, this primary evaluates to true if |
377 | the bits in | | 377 | the bits in |
378 | .Ar flags | | 378 | .Ar flags |
379 | exactly match the file's flags bits. | | 379 | exactly match the file's flags bits. |
380 | If | | 380 | If |
381 | .Ar flags | | 381 | .Ar flags |
382 | is | | 382 | is |
383 | .Dq none , | | 383 | .Dq none , |
384 | files with no flags bits set are matched. | | 384 | files with no flags bits set are matched. |
385 | (See | | 385 | (See |
386 | .Xr chflags 1 | | 386 | .Xr chflags 1 |
387 | for more information about file flags.) | | 387 | for more information about file flags.) |
388 | .Pp | | 388 | .Pp |
389 | .It Ic -follow | | 389 | .It Ic -follow |
390 | Follow symbolic links. | | 390 | Follow symbolic links. |
391 | .Pp | | 391 | .Pp |
392 | .It Ic -fprint Ar filename | | 392 | .It Ic -fprint Ar filename |
393 | This primary always evaluates to true. | | 393 | This primary always evaluates to true. |
394 | This creates | | 394 | This creates |
395 | .Ar filename | | 395 | .Ar filename |
396 | or overwrites the file if it already exists. | | 396 | or overwrites the file if it already exists. |
397 | The file is created at startup. | | 397 | The file is created at startup. |
398 | It writes the pathname of the current file to this file, followed | | 398 | It writes the pathname of the current file to this file, followed |
399 | by a newline character. | | 399 | by a newline character. |
400 | The file will be empty if no files are matched. | | 400 | The file will be empty if no files are matched. |
401 | .Pp | | 401 | .Pp |
402 | .It Ic -fstype Ar type | | 402 | .It Ic -fstype Ar type |
403 | True if the file is contained in a file system of type | | 403 | True if the file is contained in a file system of type |
404 | .Ar type . | | 404 | .Ar type . |
405 | The | | 405 | The |
406 | .Xr sysctl 8 | | 406 | .Xr sysctl 8 |
407 | command can be used to find out the types of file systems | | 407 | command can be used to find out the types of file systems |
408 | that are available on the system: | | 408 | that are available on the system: |
409 | .Bd -literal -offset indent | | 409 | .Bd -literal -offset indent |
410 | sysctl vfs.generic.fstypes | | 410 | sysctl vfs.generic.fstypes |
411 | .Ed | | 411 | .Ed |
412 | .Pp | | 412 | .Pp |
413 | In addition, there are two pseudo-types, | | 413 | In addition, there are two pseudo-types, |
414 | .Dq local | | 414 | .Dq local |
415 | and | | 415 | and |
416 | .Dq rdonly . | | 416 | .Dq rdonly . |
417 | The former matches any file system physically mounted on the system where | | 417 | The former matches any file system physically mounted on the system where |
418 | the | | 418 | the |
419 | .Nm | | 419 | .Nm |
420 | is being executed, and the latter matches any file system which is | | 420 | is being executed, and the latter matches any file system which is |
421 | mounted read-only. | | 421 | mounted read-only. |
422 | .Pp | | 422 | .Pp |
423 | .It Ic -group Ar gname | | 423 | .It Ic -group Ar gname |
424 | True if the file belongs to the group | | 424 | True if the file belongs to the group |
425 | .Ar gname . | | 425 | .Ar gname . |
426 | If | | 426 | If |
427 | .Ar gname | | 427 | .Ar gname |
428 | is numeric and there is no such group name, then | | 428 | is numeric and there is no such group name, then |
429 | .Ar gname | | 429 | .Ar gname |
430 | is treated as a group id (and considered a numeric argument). | | 430 | is treated as a group id (and considered a numeric argument). |
431 | .Pp | | 431 | .Pp |
432 | .It Ic -iname Ar pattern | | 432 | .It Ic -iname Ar pattern |
433 | True if the last component of the pathname being examined matches | | 433 | True if the last component of the pathname being examined matches |
434 | .Ar pattern | | 434 | .Ar pattern |
435 | in a case-insensitive manner. | | 435 | in a case-insensitive manner. |
436 | Special shell pattern matching characters | | 436 | Special shell pattern matching characters |
437 | .Po | | 437 | .Po |
438 | .Dq \&[ , | | 438 | .Dq \&[ , |
439 | .Dq \&] , | | 439 | .Dq \&] , |
440 | .Dq \&* , | | 440 | .Dq \&* , |
441 | and | | 441 | and |
442 | .Dq \&? | | 442 | .Dq \&? |
443 | .Pc | | 443 | .Pc |
444 | may be used as part of | | 444 | may be used as part of |
445 | .Ar pattern . | | 445 | .Ar pattern . |
446 | These characters may be matched explicitly by escaping them with a | | 446 | These characters may be matched explicitly by escaping them with a |
447 | backslash | | 447 | backslash |
448 | .Pq Dq \e . | | 448 | .Pq Dq \e . |
449 | .Pp | | 449 | .Pp |
450 | .It Ic -inum Ar n | | 450 | .It Ic -inum Ar n |
451 | True if the file has inode number | | 451 | True if the file has inode number |
452 | .Ar n . | | 452 | .Ar n . |
453 | .Pp | | 453 | .Pp |
454 | .It Ic -iregex Ar regexp | | 454 | .It Ic -iregex Ar regexp |
455 | True if the path name of the current file matches the case-insensitive | | 455 | True if the path name of the current file matches the case-insensitive |
456 | basic regular expression | | 456 | basic regular expression |
457 | .Pq see Xr re_format 7 | | 457 | .Pq see Xr re_format 7 |
458 | .Ar regexp . | | 458 | .Ar regexp . |
459 | This is a match on the whole path, not a search for the regular expression | | 459 | This is a match on the whole path, not a search for the regular expression |
460 | within the path. | | 460 | within the path. |
461 | .Pp | | 461 | .Pp |
462 | .It Ic -links Ar n | | 462 | .It Ic -links Ar n |
463 | True if the file has | | 463 | True if the file has |
464 | .Ar n | | 464 | .Ar n |
465 | links. | | 465 | links. |
466 | .Pp | | 466 | .Pp |
467 | .It Ic -rm | | 467 | .It Ic -rm |
468 | This primary is an alias for | | 468 | This primary is an alias for |
469 | .Ic -delete . | | 469 | .Ic -delete . |
470 | .Pp | | 470 | .Pp |
471 | .It Ic -ls | | 471 | .It Ic -ls |
472 | This primary always evaluates to true. | | 472 | This primary always evaluates to true. |
473 | The following information for the current file is written to standard output: | | 473 | The following information for the current file is written to standard output: |
474 | its inode number, size in 512-byte blocks, file permissions, number of hard | | 474 | its inode number, size in 512-byte blocks, file permissions, number of hard |
475 | links, owner, group, size in bytes, last modification time, and pathname. | | 475 | links, owner, group, size in bytes, last modification time, and pathname. |
476 | If the file is a block or character special file, the major and minor numbers | | 476 | If the file is a block or character special file, the major and minor numbers |
477 | will be displayed instead of the size in bytes. | | 477 | will be displayed instead of the size in bytes. |
478 | If the file is a symbolic link, the pathname of the linked-to file will be | | 478 | If the file is a symbolic link, the pathname of the linked-to file will be |
479 | displayed preceded by | | 479 | displayed preceded by |
480 | .Dq -> . | | 480 | .Dq -> . |
481 | The format is identical to that produced by | | 481 | The format is identical to that produced by |
482 | .Dq ls -dgils . | | 482 | .Dq ls -dgils . |
483 | .Pp | | 483 | .Pp |
484 | .It Ic -maxdepth Ar depth | | 484 | .It Ic -maxdepth Ar depth |
485 | True if the current search depth is less than or equal to what is specified in | | 485 | True if the current search depth is less than or equal to what is specified in |
486 | .Ar depth . | | 486 | .Ar depth . |
487 | .Pp | | 487 | .Pp |
488 | .It Ic -mindepth Ar depth | | 488 | .It Ic -mindepth Ar depth |
489 | True if the current search depth is at least what is specified in | | 489 | True if the current search depth is at least what is specified in |
490 | .Ar depth . | | 490 | .Ar depth . |
491 | .Pp | | 491 | .Pp |
492 | .It Ic -mmin Ar n | | 492 | .It Ic -mmin Ar n |
493 | True if the difference between the file last modification time and the time | | 493 | True if the difference between the file last modification time and the time |
494 | .Nm | | 494 | .Nm |
495 | was started, rounded up to the next full minute, is | | 495 | was started, rounded up to the next full minute, is |
496 | .Ar n | | 496 | .Ar n |
497 | minutes. | | 497 | minutes. |
498 | .Pp | | 498 | .Pp |
499 | .It Ic -mtime Ar n | | 499 | .It Ic -mtime Ar n |
500 | True if the difference between the file last modification time and the time | | 500 | True if the difference between the file last modification time and the time |
501 | .Nm | | 501 | .Nm |
502 | was started, rounded up to the next full 24-hour period, is | | 502 | was started, rounded up to the next full 24-hour period, is |
503 | .Ar n | | 503 | .Ar n |
504 | 24-hour periods. | | 504 | 24-hour periods. |
505 | .Pp | | 505 | .Pp |
506 | .It Ic -ok Ar utility Oo argument ... Oc Ic \&; | | 506 | .It Ic -ok Ar utility Oo argument ... Oc Ic \&; |
507 | The | | 507 | The |
508 | .Ic -ok | | 508 | .Ic -ok |
509 | primary is similar to the semicolon-terminated | | 509 | primary is similar to the semicolon-terminated |
510 | .Pq Dq \&; | | 510 | .Pq Dq \&; |
511 | variant of the | | 511 | variant of the |
512 | .Ic -exec | | 512 | .Ic -exec |
513 | primary, with the exception that | | 513 | primary, with the exception that |
514 | .Nm | | 514 | .Nm |
515 | requests user affirmation for the execution of | | 515 | requests user affirmation for the execution of |
516 | .Ar utility | | 516 | .Ar utility |
517 | by printing | | 517 | by printing |
518 | a message to the terminal and reading a response. | | 518 | a message to the terminal and reading a response. |
519 | If the response is other than | | 519 | If the response is other than |
520 | .Dq y , | | 520 | .Dq y , |
521 | the command is not executed and the | | 521 | the command is not executed and the |
522 | .Ic -ok | | 522 | .Ic -ok |
523 | primary evaluates to false. | | 523 | primary evaluates to false. |
524 | Set aggregation | | 524 | Set aggregation |
525 | .Pq Do \&+ Dc termination | | 525 | .Pq Do \&+ Dc termination |
526 | is not supported. | | 526 | is not supported. |
527 | .Pp | | 527 | .Pp |
528 | .It Ic -name Ar pattern | | 528 | .It Ic -name Ar pattern |
529 | True if the last component of the pathname being examined matches | | 529 | True if the last component of the pathname being examined matches |
530 | .Ar pattern . | | 530 | .Ar pattern . |
531 | Special shell pattern matching characters | | 531 | Special shell pattern matching characters |
532 | .Po | | 532 | .Po |
533 | .Dq \&[ , | | 533 | .Dq \&[ , |
534 | .Dq \&] , | | 534 | .Dq \&] , |
535 | .Dq \&* , | | 535 | .Dq \&* , |
536 | and | | 536 | and |
537 | .Dq \&? | | 537 | .Dq \&? |
538 | .Pc | | 538 | .Pc |
539 | may be used as part of | | 539 | may be used as part of |
540 | .Ar pattern . | | 540 | .Ar pattern . |
541 | These characters may be matched explicitly by escaping them with a | | 541 | These characters may be matched explicitly by escaping them with a |
542 | backslash | | 542 | backslash |
543 | .Pq Dq \e . | | 543 | .Pq Dq \e . |
544 | .Pp | | 544 | .Pp |
545 | .It Ic -newer Ar file | | 545 | .It Ic -newer Ar file |
546 | True if the current file has a more recent last modification time than | | 546 | True if the current file has a more recent last modification time than |
547 | .Ar file . | | 547 | .Ar file . |
548 | .Pp | | 548 | .Pp |
549 | .It Ic -newerXY Ar reference | | 549 | .It Ic -newerXY Ar reference |
550 | For compatibility with Gnu findutils. | | 550 | For compatibility with Gnu findutils. |
551 | .Bl -column -offset indent ".Sy findutils" ".Sy equivalent" | | 551 | .Bl -column -offset indent ".Sy findutils" ".Sy equivalent" |
552 | .It Sy findutils Ta Sy find | | 552 | .It Sy findutils Ta Sy find |
553 | .It Sy option Ta Sy equivalent | | 553 | .It Sy option Ta Sy equivalent |
554 | .It -neweraa Ta -anewer | | 554 | .It -neweraa Ta -anewer |
555 | .It -newerat Ta -asince | | 555 | .It -newerat Ta -asince |
556 | .It -newercc Ta -cnewer | | 556 | .It -newercc Ta -cnewer |
557 | .It -newerct Ta -csince | | 557 | .It -newerct Ta -csince |
558 | .It -newermm Ta -newer | | 558 | .It -newermm Ta -newer |
559 | .It -newermt Ta -since | | 559 | .It -newermt Ta -since |
560 | .El | | 560 | .El |
561 | .Pp | | 561 | .Pp |
562 | Other option variants from findutils are not implemented. | | 562 | Other option variants from findutils are not implemented. |
563 | .Pp | | 563 | .Pp |
564 | .It Ic -nouser | | 564 | .It Ic -nouser |
565 | True if the file belongs to an unknown user. | | 565 | True if the file belongs to an unknown user. |
566 | .Pp | | 566 | .Pp |
567 | .It Ic -nogroup | | 567 | .It Ic -nogroup |
568 | True if the file belongs to an unknown group. | | 568 | True if the file belongs to an unknown group. |
569 | .Pp | | 569 | .Pp |
570 | .It Ic -path Ar pattern | | 570 | .It Ic -path Ar pattern |
571 | True if the pathname being examined matches | | 571 | True if the pathname being examined matches |
572 | .Ar pattern . | | 572 | .Ar pattern . |
573 | Special shell pattern matching characters | | 573 | Special shell pattern matching characters |
574 | .Po | | 574 | .Po |
575 | .Dq \&[ , | | 575 | .Dq \&[ , |
576 | .Dq \&] , | | 576 | .Dq \&] , |
577 | .Dq \&* , | | 577 | .Dq \&* , |
578 | and | | 578 | and |
579 | .Dq \&? | | 579 | .Dq \&? |
580 | .Pc | | 580 | .Pc |
581 | may be used as part of | | 581 | may be used as part of |
582 | .Ar pattern . | | 582 | .Ar pattern . |
583 | These characters may be matched explicitly by escaping them with a | | 583 | These characters may be matched explicitly by escaping them with a |
584 | backslash | | 584 | backslash |
585 | .Pq Dq \e . | | 585 | .Pq Dq \e . |
586 | Slashes | | 586 | Slashes |
587 | .Pq Dq / | | 587 | .Pq Dq / |
588 | are treated as normal characters and do not have to be | | 588 | are treated as normal characters and do not have to be |
589 | matched explicitly. | | 589 | matched explicitly. |
590 | .Pp | | 590 | .Pp |
591 | .It Ic -perm Oo Fl Oc Ns Ar mode | | 591 | .It Ic -perm Oo Fl Oc Ns Ar mode |
592 | The | | 592 | The |
593 | .Ar mode | | 593 | .Ar mode |
594 | may be either symbolic (see | | 594 | may be either symbolic (see |
595 | .Xr chmod 1 ) | | 595 | .Xr chmod 1 ) |
596 | or an octal number. | | 596 | or an octal number. |
597 | If the mode is symbolic, a starting value of zero is assumed and the | | 597 | If the mode is symbolic, a starting value of zero is assumed and the |
598 | mode sets or clears permissions without regard to the process' file mode | | 598 | mode sets or clears permissions without regard to the process' file mode |
599 | creation mask. | | 599 | creation mask. |
600 | If the mode is octal, only bits 07777 | | 600 | If the mode is octal, only bits 07777 |
601 | .Pf ( Dv S_ISUID | | 601 | .Pf ( Dv S_ISUID |
602 | | | | 602 | | |
603 | .Dv S_ISGID | | 603 | .Dv S_ISGID |
604 | | | | 604 | | |
605 | .Dv S_ISTXT | | 605 | .Dv S_ISTXT |
606 | | | | 606 | | |
607 | .Dv S_IRWXU | | 607 | .Dv S_IRWXU |
608 | | | | 608 | | |
609 | .Dv S_IRWXG | | 609 | .Dv S_IRWXG |
610 | | | | 610 | | |
611 | .Dv S_IRWXO ) | | 611 | .Dv S_IRWXO ) |
612 | of the file's mode bits participate | | 612 | of the file's mode bits participate |
613 | in the comparison. | | 613 | in the comparison. |
614 | If the mode is preceded by a dash | | 614 | If the mode is preceded by a dash |
615 | .Pq Dq Ic \- , | | 615 | .Pq Dq Ic \- , |
616 | this primary evaluates to true | | 616 | this primary evaluates to true |
617 | if at least all of the bits in the mode are set in the file's mode bits. | | 617 | if at least all of the bits in the mode are set in the file's mode bits. |
618 | If the mode is not preceded by a dash, this primary evaluates to true if | | 618 | If the mode is not preceded by a dash, this primary evaluates to true if |
619 | the bits in the mode exactly match the file's mode bits. | | 619 | the bits in the mode exactly match the file's mode bits. |
620 | Note, the first character of a symbolic mode may not be a dash | | 620 | Note, the first character of a symbolic mode may not be a dash |
621 | .Pq Dq Ic \- . | | 621 | .Pq Dq Ic \- . |
622 | .Pp | | 622 | .Pp |
623 | .It Ic -print | | 623 | .It Ic -print |
624 | This primary always evaluates to true. | | 624 | This primary always evaluates to true. |
625 | It prints the pathname of the current file to standard output, followed | | 625 | It prints the pathname of the current file to standard output, followed |
626 | by a newline character. | | 626 | by a newline character. |
627 | If none of | | 627 | If none of |
628 | .Ic -delete , | | 628 | .Ic -delete , |
629 | .Ic -exec , | | 629 | .Ic -exec , |
630 | .Ic -execdir , | | 630 | .Ic -execdir , |
631 | .Ic -exit , | | 631 | .Ic -exit , |
632 | .Ic -fprint , | | 632 | .Ic -fprint , |
633 | .Ic -ls , | | 633 | .Ic -ls , |
634 | .Ic -ok , | | 634 | .Ic -ok , |
635 | .Ic -print0 , | | 635 | .Ic -print0 , |
636 | .Ic -printx , | | 636 | .Ic -printx , |
637 | nor | | 637 | nor |
638 | .Ic -rm | | 638 | .Ic -rm |
639 | is specified, the given expression shall be effectively replaced by | | 639 | is specified, the given expression shall be effectively replaced by |
640 | .Cm \&( Ns Ar given\& expression Ns Cm \&) | | 640 | .Cm \&( Ns Ar given\& expression Ns Cm \&) |
641 | .Ic -print . | | 641 | .Ic -print . |
642 | .Pp | | 642 | .Pp |
643 | .It Ic -print0 | | 643 | .It Ic -print0 |
644 | This primary always evaluates to true. | | 644 | This primary always evaluates to true. |
645 | It prints the pathname of the current file to standard output, followed | | 645 | It prints the pathname of the current file to standard output, followed |
646 | by a NUL character. | | 646 | by a NUL character. |
647 | .Pp | | 647 | .Pp |
648 | .It Ic -printx | | 648 | .It Ic -printx |
649 | This primary always evaluates to true. | | 649 | This primary always evaluates to true. |
650 | It prints the pathname of the current file to standard output, | | 650 | It prints the pathname of the current file to standard output, |
651 | with each space, tab, newline, backslash, dollar sign, and single, | | 651 | with each space, tab, newline, backslash, dollar sign, and single, |
652 | double, or back quotation mark prefixed by a backslash, so the output of | | 652 | double, or back quotation mark prefixed by a backslash, so the output of |
653 | .Nm | | 653 | .Nm |
654 | can safely be used as input to | | 654 | can safely be used as input to |
655 | .Xr xargs 1 . | | 655 | .Xr xargs 1 . |
656 | .Pp | | 656 | .Pp |
657 | .It Ic -prune | | 657 | .It Ic -prune |
658 | This primary always evaluates to true. | | 658 | This primary always evaluates to true. |
659 | It causes | | 659 | It causes |
660 | .Nm | | 660 | .Nm |
661 | to not descend into the current file. | | 661 | to not descend into the current file. |
662 | Note, the | | 662 | Note, the |
663 | .Ic -prune | | 663 | .Ic -prune |
664 | primary has no effect if the | | 664 | primary has no effect if the |
665 | .Fl d | | 665 | .Fl d |
666 | option was specified. | | 666 | option was specified. |
667 | .Pp | | 667 | .Pp |
668 | .It Ic -regex Ar regexp | | 668 | .It Ic -regex Ar regexp |
669 | True if the path name of the current file matches the case-sensitive | | 669 | True if the path name of the current file matches the case-sensitive |
670 | basic regular expression | | 670 | basic regular expression |
671 | .Pq see Xr re_format 7 | | 671 | .Pq see Xr re_format 7 |
672 | .Ar regexp . | | 672 | .Ar regexp . |
673 | This is a match on the whole path, not a search for the regular expression | | 673 | This is a match on the whole path, not a search for the regular expression |
674 | within the path. | | 674 | within the path. |
675 | .Pp | | 675 | .Pp |
676 | .It Ic -since Ar timestamp | | 676 | .It Ic -since Ar timestamp |
677 | True if the file last modification time is more recent than | | 677 | True if the file last modification time is more recent than |
678 | .Ar timestamp . | | 678 | .Ar timestamp . |
679 | .Pp | | 679 | .Pp |
680 | .It Ic -size Ar n Ns Op Cm c | | 680 | .It Ic -size Ar n Ns Op Cm c |
681 | True if the file's size, rounded up, in 512-byte blocks is | | 681 | True if the file's size, rounded up, in 512-byte blocks is |
682 | .Ar n . | | 682 | .Ar n . |
683 | If | | 683 | If |
684 | .Ar n | | 684 | .Ar n |
685 | is followed by a | | 685 | is followed by a |
686 | .Dq Ic c , | | 686 | .Dq Ic c , |
687 | then the primary is true if the file's size is | | 687 | then the primary is true if the file's size is |
688 | .Ar n | | 688 | .Ar n |
689 | bytes. | | 689 | bytes. |
690 | .Pp | | 690 | .Pp |
691 | .It Ic -type Ar t | | 691 | .It Ic -type Ar t |
692 | True if the file is of the specified type. | | 692 | True if the file is of the specified type. |
693 | Possible file types are as follows: | | 693 | Possible file types are as follows: |
694 | .Pp | | 694 | .Pp |
695 | .Bl -tag -width flag -offset indent -compact | | 695 | .Bl -tag -width flag -offset indent -compact |
696 | .It Cm b | | 696 | .It Cm b |
697 | block special | | 697 | block special |
698 | .It Cm c | | 698 | .It Cm c |
699 | character special | | 699 | character special |
700 | .It Cm d | | 700 | .It Cm d |
701 | directory | | 701 | directory |
702 | .It Cm f | | 702 | .It Cm f |
703 | regular file | | 703 | regular file |
704 | .It Cm l | | 704 | .It Cm l |
705 | symbolic link | | 705 | symbolic link |
706 | .It Cm p | | 706 | .It Cm p |
707 | FIFO | | 707 | FIFO |
708 | .It Cm s | | 708 | .It Cm s |
709 | socket | | 709 | socket |
710 | .It Cm W | | 710 | .It Cm W |
711 | whiteout | | 711 | whiteout |
712 | .It Cm w | | 712 | .It Cm w |
713 | whiteout | | 713 | whiteout |
714 | .El | | 714 | .El |
715 | .Pp | | 715 | .Pp |
716 | .It Ic -user Ar username | | 716 | .It Ic -user Ar username |
717 | True if the file belongs to the user | | 717 | True if the file belongs to the user |
718 | .Ar username . | | 718 | .Ar username . |
719 | If | | 719 | If |
720 | .Ar username | | 720 | .Ar username |
721 | is numeric and there is no such user on the system, then | | 721 | is numeric and there is no such user on the system, then |
722 | .Ar username | | 722 | .Ar username |
723 | is treated as a user id (and considered a numeric argument). | | 723 | is treated as a user id (and considered a numeric argument). |
724 | .Pp | | 724 | .Pp |
725 | .It Ic -xdev | | 725 | .It Ic -xdev |
726 | This primary always evaluates to true. | | 726 | This primary always evaluates to true. |
727 | It causes find not to descend past directories that have a different | | 727 | It causes find not to descend past directories that have a different |
728 | device ID | | 728 | device ID |
729 | .Va ( st_dev , | | 729 | .Va ( st_dev , |
730 | see | | 730 | see |
731 | .Xr stat 2 | | 731 | .Xr stat 2 |
732 | S5.6.2 [POSIX.1]). | | 732 | S5.6.2 [POSIX.1]). |
733 | .El | | 733 | .El |
734 | .Sh OPERATORS | | 734 | .Sh OPERATORS |
735 | The primaries may be combined using the following operators. | | 735 | The primaries may be combined using the following operators. |
736 | The operators are listed in order of decreasing precedence. | | 736 | The operators are listed in order of decreasing precedence. |
737 | .Bl -tag -width (expression) | | 737 | .Bl -tag -width (expression) |
738 | .It Cm \&( Ar expression Cm \&) | | 738 | .It Cm \&( Ar expression Cm \&) |
739 | This evaluates to true if the parenthesized expression evaluates to | | 739 | This evaluates to true if the parenthesized expression evaluates to |
740 | true. | | 740 | true. |
741 | .It Cm \&! Ar expression | | 741 | .It Cm \&! Ar expression |
| | | 742 | .It Cm -not Ar expression |
742 | This is the unary | | 743 | This is the unary |
743 | .Tn NOT | | 744 | .Tn NOT |
744 | operator. | | 745 | operator. |
745 | It evaluates to true if the expression is false. | | 746 | It evaluates to true if the expression is false. |
746 | .It Ar expression Cm -and Ar expression | | 747 | .It Ar expression Cm -and Ar expression |
747 | .It Ar expression expression | | 748 | .It Ar expression expression |
748 | The | | 749 | The |
749 | .Cm -and | | 750 | .Cm -and |
750 | operator is the logical | | 751 | operator is the logical |
751 | .Tn AND | | 752 | .Tn AND |
752 | operator. | | 753 | operator. |
753 | As it is implied by the juxtaposition of two expressions it does not | | 754 | As it is implied by the juxtaposition of two expressions it does not |
754 | have to be specified. | | 755 | have to be specified. |
755 | The expression evaluates to true if both expressions are true. | | 756 | The expression evaluates to true if both expressions are true. |
756 | The second expression is not evaluated if the first expression is false. | | 757 | The second expression is not evaluated if the first expression is false. |
757 | .It Ar expression Cm -or Ar expression | | 758 | .It Ar expression Cm -or Ar expression |
758 | The | | 759 | The |
759 | .Cm -or | | 760 | .Cm -or |
760 | operator is the logical | | 761 | operator is the logical |
761 | .Tn OR | | 762 | .Tn OR |
762 | operator. | | 763 | operator. |
763 | The expression evaluates to true if either the first or the second expression | | 764 | The expression evaluates to true if either the first or the second expression |
764 | is true. | | 765 | is true. |
765 | The second expression is not evaluated if the first expression is true. | | 766 | The second expression is not evaluated if the first expression is true. |
766 | .El | | 767 | .El |
767 | .Pp | | 768 | .Pp |
768 | All operands and primaries must be separate arguments to | | 769 | All operands and primaries must be separate arguments to |
769 | .Nm . | | 770 | .Nm . |
770 | Primaries which themselves take arguments expect each argument | | 771 | Primaries which themselves take arguments expect each argument |
771 | to be a separate argument to | | 772 | to be a separate argument to |
772 | .Nm . | | 773 | .Nm . |
773 | .Sh EXIT STATUS | | 774 | .Sh EXIT STATUS |
774 | The | | 775 | The |
775 | .Nm | | 776 | .Nm |
776 | utility normally exits 0 on success, and exits with 1 under certain | | 777 | utility normally exits 0 on success, and exits with 1 under certain |
777 | internal error conditions. | | 778 | internal error conditions. |
778 | If any invocations of | | 779 | If any invocations of |
779 | .Dq Ic -exec Ar ... Ic \&+ | | 780 | .Dq Ic -exec Ar ... Ic \&+ |
780 | primaries return non-zero exit-status, then | | 781 | primaries return non-zero exit-status, then |
781 | .Nm | | 782 | .Nm |
782 | will do so as well. | | 783 | will do so as well. |
783 | .Sh EXAMPLES | | 784 | .Sh EXAMPLES |
784 | The following examples are shown as given to the shell: | | 785 | The following examples are shown as given to the shell: |
785 | .Bl -tag -width findx | | 786 | .Bl -tag -width findx |
786 | .It Li "find / \e! -name \*q*.c\*q \-print" | | 787 | .It Li "find / \e! -name \*q*.c\*q \-print" |
787 | Print out a list of all the files whose names do not end in | | 788 | Print out a list of all the files whose names do not end in |
788 | .Dq \&.c . | | 789 | .Dq \&.c . |
789 | .It Li "find / \-newer ttt \-user wnj \-print" | | 790 | .It Li "find / \-newer ttt \-user wnj \-print" |
790 | Print out a list of all the files owned by user | | 791 | Print out a list of all the files owned by user |
791 | .Dq wnj | | 792 | .Dq wnj |
792 | that are newer than the file | | 793 | that are newer than the file |
793 | .Dq ttt . | | 794 | .Dq ttt . |
794 | .It Li "find . \-type f \-mmin \-30 \-print \-or \-mindepth 1 \-prune" | | 795 | .It Li "find . \-type f \-mmin \-30 \-print \-or \-mindepth 1 \-prune" |
795 | Print out a list of all the files in the current directory that are | | 796 | Print out a list of all the files in the current directory that are |
796 | newer than 30 minutes. | | 797 | newer than 30 minutes. |
797 | .It Li "find . \-type f \-atime +10 \-mindepth 2 \-print" | | 798 | .It Li "find . \-type f \-atime +10 \-mindepth 2 \-print" |
798 | Print out a list of all the files in any sub-directories that have not | | 799 | Print out a list of all the files in any sub-directories that have not |
799 | been accessed in the past ten days. | | 800 | been accessed in the past ten days. |
800 | .It Li "find . \-mtime +90 \-exec rm \-i {} + \-or \-mindepth 1 \-prune" | | 801 | .It Li "find . \-mtime +90 \-exec rm \-i {} + \-or \-mindepth 1 \-prune" |
801 | Interactively remove all of the files in the current directory that have | | 802 | Interactively remove all of the files in the current directory that have |
802 | not been modified in 90 days. | | 803 | not been modified in 90 days. |
803 | .It Li "find . \-type f \-mtime +90 \-ok mv {} {}.old \e;" | | 804 | .It Li "find . \-type f \-mtime +90 \-ok mv {} {}.old \e;" |
804 | Interactively rename all of the files in the current directory and all | | 805 | Interactively rename all of the files in the current directory and all |
805 | sub-directories that have not been modified in 90 days. | | 806 | sub-directories that have not been modified in 90 days. |
806 | .It Li "find / \e! \e( \-newer ttt \-user wnj \e) \-print" | | 807 | .It Li "find / \e! \e( \-newer ttt \-user wnj \e) \-print" |
807 | Print out a list of all the files which are not both newer than | | 808 | Print out a list of all the files which are not both newer than |
808 | .Dq ttt | | 809 | .Dq ttt |
809 | and owned by | | 810 | and owned by |
810 | .Dq wnj . | | 811 | .Dq wnj . |
811 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-print" | | 812 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-print" |
812 | Print out a list of all the files that are either owned by | | 813 | Print out a list of all the files that are either owned by |
813 | .Dq wnj | | 814 | .Dq wnj |
814 | or that are newer than | | 815 | or that are newer than |
815 | .Dq ttt . | | 816 | .Dq ttt . |
816 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-exit 1" | | 817 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-exit 1" |
817 | Return immediately with a value of 1 if any files are found that are either | | 818 | Return immediately with a value of 1 if any files are found that are either |
818 | owned by | | 819 | owned by |
819 | .Dq wnj | | 820 | .Dq wnj |
820 | or that are newer than | | 821 | or that are newer than |
821 | .Dq ttt , | | 822 | .Dq ttt , |
822 | but do not print them. | | 823 | but do not print them. |
823 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-ls \-exit 1" | | 824 | .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-ls \-exit 1" |
824 | Same as above, but list the first file matching the criteria before exiting | | 825 | Same as above, but list the first file matching the criteria before exiting |
825 | with a value of 1. | | 826 | with a value of 1. |
826 | .It Li "find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \;" | | 827 | .It Li "find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \;" |
827 | Perform an arbitrarily complex shell command for every file. | | 828 | Perform an arbitrarily complex shell command for every file. |
828 | .El | | 829 | .El |
829 | .Sh SEE ALSO | | 830 | .Sh SEE ALSO |
830 | .Xr chflags 1 , | | 831 | .Xr chflags 1 , |
831 | .Xr chmod 1 , | | 832 | .Xr chmod 1 , |
832 | .Xr locate 1 , | | 833 | .Xr locate 1 , |
833 | .Xr xargs 1 , | | 834 | .Xr xargs 1 , |
834 | .Xr stat 2 , | | 835 | .Xr stat 2 , |
835 | .Xr fts 3 , | | 836 | .Xr fts 3 , |
836 | .Xr getgrent 3 , | | 837 | .Xr getgrent 3 , |
837 | .Xr getpwent 3 , | | 838 | .Xr getpwent 3 , |
838 | .Xr strmode 3 , | | 839 | .Xr strmode 3 , |
839 | .Xr re_format 7 , | | 840 | .Xr re_format 7 , |
840 | .Xr symlink 7 , | | 841 | .Xr symlink 7 , |
841 | .Xr sysctl 8 | | 842 | .Xr sysctl 8 |
842 | .Sh STANDARDS | | 843 | .Sh STANDARDS |
843 | The | | 844 | The |
844 | .Nm | | 845 | .Nm |
845 | utility syntax is a superset of the syntax specified by the | | 846 | utility syntax is a superset of the syntax specified by the |
846 | .St -p1003.2 | | 847 | .St -p1003.2 |
847 | standard. | | 848 | standard. |
848 | .Pp | | 849 | .Pp |
849 | The options and the | | 850 | The options, the |
850 | .Ic -amin , | | 851 | .Ic -amin , |
851 | .Ic -anewer , | | 852 | .Ic -anewer , |
852 | .Ic -asince , | | 853 | .Ic -asince , |
853 | .Ic -cmin , | | 854 | .Ic -cmin , |
854 | .Ic -cnewer , | | 855 | .Ic -cnewer , |
855 | .Ic -csince , | | 856 | .Ic -csince , |
856 | .Ic -delete , | | 857 | .Ic -delete , |
857 | .Ic -empty , | | 858 | .Ic -empty , |
858 | .Ic -execdir , | | 859 | .Ic -execdir , |
859 | .Ic -follow , | | 860 | .Ic -follow , |
860 | .Ic -fstype , | | 861 | .Ic -fstype , |
861 | .Ic -iname , | | 862 | .Ic -iname , |
862 | .Ic -inum , | | 863 | .Ic -inum , |
863 | .Ic -iregex , | | 864 | .Ic -iregex , |
864 | .Ic -links , | | 865 | .Ic -links , |
865 | .Ic -ls , | | 866 | .Ic -ls , |
866 | .Ic -maxdepth , | | 867 | .Ic -maxdepth , |
867 | .Ic -mindepth , | | 868 | .Ic -mindepth , |
868 | .Ic -mmin , | | 869 | .Ic -mmin , |
869 | .Ic -path , | | 870 | .Ic -path , |
870 | .Ic -print0 , | | 871 | .Ic -print0 , |
871 | .Ic -printx , | | 872 | .Ic -printx , |
872 | .Ic -regex , | | 873 | .Ic -regex , |
873 | .Ic -rm , | | 874 | .Ic -rm , |
874 | and | | 875 | and |
875 | .Ic -since | | 876 | .Ic -since |
876 | primaries are extensions to | | 877 | primaries, and the |
| | | 878 | .Ic -not |
| | | 879 | operator are extensions to |
877 | .St -p1003.2 . | | 880 | .St -p1003.2 . |
878 | .Pp | | 881 | .Pp |
879 | Historically, the | | 882 | Historically, the |
880 | .Fl d , | | 883 | .Fl d , |
881 | .Fl h , | | 884 | .Fl h , |
882 | and | | 885 | and |
883 | .Fl x | | 886 | .Fl x |
884 | options were implemented using the primaries | | 887 | options were implemented using the primaries |
885 | .Dq Ic -depth , | | 888 | .Dq Ic -depth , |
886 | .Dq Ic -follow , | | 889 | .Dq Ic -follow , |
887 | and | | 890 | and |
888 | .Dq Ic -xdev . | | 891 | .Dq Ic -xdev . |
889 | These primaries always evaluated to true, and always | | 892 | These primaries always evaluated to true, and always |
890 | took effect when the | | 893 | took effect when the |
891 | .Ar expression | | 894 | .Ar expression |
892 | was parsed, before the file system traversal began. | | 895 | was parsed, before the file system traversal began. |
893 | As a result, some legal expressions could be confusing. | | 896 | As a result, some legal expressions could be confusing. |
894 | For example, in the expression | | 897 | For example, in the expression |
895 | .Dq Ic -print Ic -or Ic -depth , | | 898 | .Dq Ic -print Ic -or Ic -depth , |
896 | .Ic -print | | 899 | .Ic -print |
897 | always evaluates to true, so the standard meaning of | | 900 | always evaluates to true, so the standard meaning of |
898 | .Ic -or | | 901 | .Ic -or |
899 | implies that | | 902 | implies that |
900 | .Ic -depth | | 903 | .Ic -depth |
901 | would never be evaluated, but that is not what happens; | | 904 | would never be evaluated, but that is not what happens; |
902 | in fact, | | 905 | in fact, |
903 | .Ic -depth | | 906 | .Ic -depth |
904 | takes effect immediately, without testing whether | | 907 | takes effect immediately, without testing whether |
905 | .Ic -print | | 908 | .Ic -print |
906 | returns true or false. | | 909 | returns true or false. |
907 | .Pp | | 910 | .Pp |
908 | Historically, the operator | | 911 | Historically, the operator |
909 | .Dq Ic -or | | 912 | .Dq Ic -or |
910 | was implemented as | | 913 | was implemented as |
911 | .Dq Ic -o , | | 914 | .Dq Ic -o , |
912 | and the operator | | 915 | and the operator |
913 | .Dq Ic -and | | 916 | .Dq Ic -and |
914 | was implemented as | | 917 | was implemented as |
915 | .Dq Ic -a . | | 918 | .Dq Ic -a . |
916 | .Pp | | 919 | .Pp |
917 | Historic implementations of the | | 920 | Historic implementations of the |
918 | .Dq Ic -exec | | 921 | .Dq Ic -exec |
919 | and | | 922 | and |
920 | .Dq Ic -ok | | 923 | .Dq Ic -ok |
921 | primaries did not replace the string | | 924 | primaries did not replace the string |
922 | .Dq Ic {} | | 925 | .Dq Ic {} |
923 | in the utility name or the | | 926 | in the utility name or the |
924 | utility arguments if it did not appear as a separate argument. | | 927 | utility arguments if it did not appear as a separate argument. |
925 | This version replaces it no matter where in the utility name or arguments | | 928 | This version replaces it no matter where in the utility name or arguments |
926 | it appears. | | 929 | it appears. |
927 | .Pp | | 930 | .Pp |
928 | Support for | | 931 | Support for |
929 | .Dq Ic -exec Ar ... Ic \&+ | | 932 | .Dq Ic -exec Ar ... Ic \&+ |
930 | is consistent with | | 933 | is consistent with |
931 | .Em IEEE PASC Interpretation 1003.2 #210 , | | 934 | .Em IEEE PASC Interpretation 1003.2 #210 , |
932 | though the feature originated in | | 935 | though the feature originated in |
933 | .Tn SVR4 . | | 936 | .Tn SVR4 . |
934 | .Pp | | 937 | .Pp |
935 | The | | 938 | The |
936 | .Ic -delete | | 939 | .Ic -delete |
937 | primary does not interact well with other options that cause the file system | | 940 | primary does not interact well with other options that cause the file system |
938 | tree traversal options to be changed. | | 941 | tree traversal options to be changed. |
939 | .Sh HISTORY | | 942 | .Sh HISTORY |
940 | A much simpler | | 943 | A much simpler |
941 | .Nm | | 944 | .Nm |
942 | command appeared in First Edition AT&T Unix. | | 945 | command appeared in First Edition AT&T Unix. |
943 | The syntax had become similar to the present version by | | 946 | The syntax had become similar to the present version by |
944 | the time of the Fifth Edition. | | 947 | the time of the Fifth Edition. |
945 | .Sh BUGS | | 948 | .Sh BUGS |
946 | The special characters used by | | 949 | The special characters used by |
947 | .Nm | | 950 | .Nm |
948 | are also special characters to many shell programs. | | 951 | are also special characters to many shell programs. |
949 | In particular, the characters | | 952 | In particular, the characters |
950 | .Dq \&* , | | 953 | .Dq \&* , |
951 | .Dq \&[ , | | 954 | .Dq \&[ , |
952 | .Dq \&] , | | 955 | .Dq \&] , |
953 | .Dq \&? , | | 956 | .Dq \&? , |
954 | .Dq \&( , | | 957 | .Dq \&( , |
955 | .Dq \&) , | | 958 | .Dq \&) , |
956 | .Dq \&! , | | 959 | .Dq \&! , |
957 | .Dq \e , | | 960 | .Dq \e , |
958 | and | | 961 | and |
959 | .Dq \&; | | 962 | .Dq \&; |
960 | may have to be escaped from the shell. | | 963 | may have to be escaped from the shell. |
961 | .Pp | | 964 | .Pp |
962 | As there is no delimiter separating options and file names or file | | 965 | As there is no delimiter separating options and file names or file |
963 | names and the | | 966 | names and the |
964 | .Ar expression , | | 967 | .Ar expression , |
965 | it is difficult to specify files named | | 968 | it is difficult to specify files named |
966 | .Dq -xdev | | 969 | .Dq -xdev |
967 | or | | 970 | or |
968 | .Dq \&! . | | 971 | .Dq \&! . |
969 | These problems are handled by the | | 972 | These problems are handled by the |
970 | .Fl f | | 973 | .Fl f |
971 | option and the | | 974 | option and the |
972 | .Xr getopt 3 | | 975 | .Xr getopt 3 |
973 | .Dq -- | | 976 | .Dq -- |
974 | construct. | | 977 | construct. |