Print this page
12328 FNMPERIOD makes little sense for find -path
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/find.1
+++ new/usr/src/man/man1/find.1
1 1 .\"
2 2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 3 .\" permission to reproduce portions of its copyrighted documentation.
4 4 .\" Original documentation from The Open Group can be obtained online at
5 5 .\" http://www.opengroup.org/bookstore/.
6 6 .\"
7 7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 8 .\" Group, have given us permission to reprint portions of their
9 9 .\" documentation.
10 10 .\"
11 11 .\" In the following statement, the phrase ``this text'' refers to portions
12 12 .\" of the system documentation.
13 13 .\"
14 14 .\" Portions of this text are reprinted and reproduced in electronic form
15 15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 16 .\" Standard for Information Technology -- Portable Operating System
17 17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 20 .\" between these versions and the original IEEE and The Open Group
21 21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 22 .\" document. The original Standard can be obtained online at
23 23 .\" http://www.opengroup.org/unix/online.html.
24 24 .\"
25 25 .\" This notice shall appear on any product containing this material.
26 26 .\"
27 27 .\" The contents of this file are subject to the terms of the
28 28 .\" Common Development and Distribution License (the "License").
29 29 .\" You may not use this file except in compliance with the License.
30 30 .\"
31 31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 32 .\" or http://www.opensolaris.org/os/licensing.
33 33 .\" See the License for the specific language governing permissions
34 34 .\" and limitations under the License.
35 35 .\"
36 36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
38 38 .\" If applicable, add the following below this CDDL HEADER, with the
39 39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 41 .\"
42 42 .\"
43 43 .\" Copyright 1989 AT&T
44 44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 45 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
46 46 .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved.
47 47 .\" Copyright (c) 2013 Andrew Stormont. All rights reserved.
48 +.\" Copyright 2020 Joyent, Inc.
48 49 .\"
49 -.TH FIND 1 "Sep 5, 2011"
50 +.TH FIND 1 "Feb 20, 2020"
50 51 .SH NAME
51 52 find \- find files
52 53 .SH SYNOPSIS
53 -.LP
54 54 .nf
55 55 \fB/usr/bin/find\fR [\fB-E\fR] [\fB-H\fR | \fB-L\fR] \fIpath\fR... \fIexpression\fR
56 56 .fi
57 57
58 58 .LP
59 59 .nf
60 60 \fB/usr/xpg4/bin/find\fR [\fB-H\fR | \fB-L\fR] \fIpath\fR... \fIexpression\fR
61 61 .fi
62 62
63 63 .SH DESCRIPTION
64 -.LP
65 64 The \fBfind\fR utility recursively descends the directory hierarchy for each
66 65 \fIpath\fR seeking files that match a Boolean \fIexpression\fR written in the
67 66 primaries specified below.
68 67 .sp
69 68 .LP
70 69 \fBfind\fR is able to descend to arbitrary depths in a file hierarchy and does
71 70 not fail due to path length limitations (unless a \fIpath\fR operand specified
72 71 by the application exceeds \fIPATH_MAX\fR requirements).
73 72 .sp
74 73 .LP
75 74 \fBfind\fR detects infinite loops; that is, entering a previously visited
76 75 directory that is an ancestor of the last file encountered.
77 76 .SH OPTIONS
78 -.LP
79 77 The following options are supported:
80 78 .sp
81 79 .ne 2
82 80 .na
83 81 \fB\fB-E\fR\fR
84 82 .ad
85 83 .RS 6n
86 84 Interpret regular expressions followed by \fB-regex\fR and \fB-iregex\fR
87 85 primaries as extended regular expressions.
88 86 .RE
89 87
90 88 .sp
91 89 .ne 2
92 90 .na
93 91 \fB\fB-H\fR\fR
94 92 .ad
95 93 .RS 6n
96 94 Causes the file information and file type evaluated for each symbolic link
97 95 encountered on the command line to be those of the file referenced by the link,
98 96 and not the link itself. If the referenced file does not exist, the file
99 97 information and type is for the link itself. File information for all symbolic
100 98 links not on the command line is that of the link itself.
101 99 .RE
102 100
103 101 .sp
104 102 .ne 2
105 103 .na
106 104 \fB\fB-L\fR\fR
107 105 .ad
108 106 .RS 6n
109 107 Causes the file information and file type evaluated for each symbolic link to
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
110 108 be those of the file referenced by the link, and not the link itself. See
111 109 \fBNOTES\fR.
112 110 .RE
113 111
114 112 .sp
115 113 .LP
116 114 Specifying more than one of the mutually-exclusive options \fB-H\fR and
117 115 \fB-L\fR is not considered an error. The last option specified determines the
118 116 behavior of the utility.
119 117 .SH OPERANDS
120 -.LP
121 118 The following operands are supported:
122 119 .sp
123 120 .ne 2
124 121 .na
125 122 \fB\fIpath\fR\fR
126 123 .ad
127 124 .RS 14n
128 125 A pathname of a starting point in the directory hierarchy.
129 126 .RE
130 127
131 128 .sp
132 129 .ne 2
133 130 .na
134 131 \fB\fIexpression\fR\fR
135 132 .ad
136 133 .RS 14n
137 134 The first argument that starts with a \fB\(mi\fR, or is a \fB!\fR or a \fB(\fR,
138 135 and all subsequent arguments are interpreted as an \fIexpression\fR made up of
139 136 the following primaries and operators. In the descriptions, wherever \fIn\fR is
140 137 used as a primary argument, it is interpreted as a decimal integer optionally
141 138 preceded by a plus (\fB+\fR) or minus (\fB\(mi\fR) sign, as follows:
142 139 .sp
143 140 .ne 2
144 141 .na
145 142 \fB+\fIn\fR\fR
146 143 .ad
147 144 .RS 6n
148 145 more than \fIn\fR
149 146 .RE
150 147
151 148 .sp
152 149 .ne 2
153 150 .na
154 151 \fB\fIn\fR\fR
155 152 .ad
156 153 .RS 6n
157 154 exactly \fIn\fR
158 155 .RE
159 156
160 157 .sp
161 158 .ne 2
↓ open down ↓ |
31 lines elided |
↑ open up ↑ |
162 159 .na
163 160 \fB-\fIn\fR\fR
164 161 .ad
165 162 .RS 6n
166 163 less than \fIn\fR
167 164 .RE
168 165
169 166 .RE
170 167
171 168 .SS "Expressions"
172 -.LP
173 169 Valid expressions are:
174 170 .sp
175 171 .ne 2
176 172 .na
177 173 \fB\fB-acl\fR\fR
178 174 .ad
179 175 .RS 17n
180 176 True if the file have additional ACLs defined.
181 177 .RE
182 178
183 179 .sp
184 180 .ne 2
185 181 .na
186 182 \fB\fB-amin\fR \fIn\fR\fR
187 183 .ad
188 184 .RS 17n
189 185 File was last accessed \fIn\fR minutes ago.
190 186 .RE
191 187
192 188 .sp
193 189 .ne 2
194 190 .na
195 191 \fB\fB-atime\fR \fIn\fR\fR
196 192 .ad
197 193 .RS 17n
198 194 True if the file was accessed \fIn\fR days ago. The access time of directories
199 195 in \fIpath\fR is changed by \fBfind\fR itself.
200 196 .RE
201 197
202 198 .sp
203 199 .ne 2
204 200 .na
205 201 \fB\fB-cmin\fR \fIn\fR\fR
206 202 .ad
207 203 .RS 17n
208 204 File's status was last changed \fIn\fR minutes ago.
209 205 .RE
210 206
211 207 .sp
212 208 .ne 2
213 209 .na
214 210 \fB\fB-cpio\fR \fIdevice\fR\fR
215 211 .ad
216 212 .RS 17n
217 213 Always true. Writes the current file on \fIdevice\fR in \fBcpio\fR format
218 214 (5120-byte records).
219 215 .RE
220 216
221 217 .sp
222 218 .ne 2
223 219 .na
224 220 \fB\fB-ctime\fR \fIn\fR\fR
225 221 .ad
226 222 .RS 17n
227 223 True if the file's status was changed \fIn\fR days ago.
228 224 .RE
229 225
230 226 .sp
231 227 .ne 2
232 228 .na
233 229 \fB\fB-depth\fR\fR
234 230 .ad
235 231 .RS 17n
236 232 Always true. Causes descent of the directory hierarchy to be done so that all
237 233 entries in a directory are acted on before the directory itself. This can be
238 234 useful when \fBfind\fR is used with \fBcpio\fR(1) to transfer files that are
239 235 contained in directories without write permission.
240 236 .RE
241 237
242 238 .sp
243 239 .ne 2
244 240 .na
245 241 \fB\fB-exec\fR \fIcommand\fR\fR
246 242 .ad
247 243 .RS 17n
248 244 True if the executed command returns a zero value as exit status. The end of
249 245 command must be punctuated by an escaped semicolon (\fB;\fR). A command
250 246 argument \fB{}\fR is replaced by the current pathname. If the last argument to
251 247 \fB-exec\fR is \fB{}\fR and you specify \fB+\fR rather than the semicolon
252 248 (\fB;\fR), the command is invoked fewer times, with \fB{}\fR replaced by groups
253 249 of pathnames. If any invocation of the command returns a non-zero value as exit
254 250 status, find returns a non-zero exit status.
255 251 .RE
256 252
257 253 .sp
258 254 .ne 2
259 255 .na
260 256 \fB\fB-follow\fR\fR
261 257 .ad
262 258 .RS 17n
263 259 Always true and always evaluated no matter where it appears in
264 260 \fIexpression\fR. The behavior is unspecified if \fB-follow\fR is used when the
265 261 \fBfind\fR command is invoked with either the \fB-H\fR or the \fB-L\fR option.
266 262 Causes symbolic links to be followed. When following symbolic links, \fBfind\fR
267 263 keeps track of the directories visited so that it can detect infinite loops.
268 264 For example, such a loop would occur if a symbolic link pointed to an ancestor.
269 265 This expression should not be used with the find-type \fBl\fR expression. See
270 266 \fBNOTES\fR.
271 267 .RE
272 268
273 269 .sp
274 270 .ne 2
275 271 .na
276 272 \fB\fB-fstype\fR \fItype\fR\fR
277 273 .ad
278 274 .RS 17n
279 275 True if the filesystem to which the file belongs is of type \fItype\fR.
280 276 .RE
281 277
282 278 .sp
283 279 .ne 2
284 280 .na
285 281 \fB\fB-group\fR \fIgname\fR\fR
286 282 .ad
287 283 .RS 17n
288 284 True if the file belongs to the group \fIgname\fR. If \fIgname\fR is numeric
289 285 and there's no such group name, it is taken as a group \fBID\fR.
290 286 .RE
291 287
292 288 .sp
293 289 .ne 2
294 290 .na
295 291 \fB\fB-groupacl\fR \fIgname\fR\fR
296 292 .ad
297 293 .RS 17n
298 294 True if the file's ACL contains an entry for the group \fIgname\fR.
299 295 If \fIgname\fR is numeric and there's no such group name, it is taken
300 296 as a group \fBID\fR.
301 297 .RE
302 298
303 299 .sp
304 300 .ne 2
305 301 .na
306 302 \fB\fB-iname\fR \fIpattern\fR\fR
307 303 .ad
308 304 .RS 17n
309 305 Like \fB-name\fR, but the match is case insensitive.
310 306 .RE
311 307
312 308 .sp
313 309 .ne 2
314 310 .na
315 311 \fB\fB-inum\fR \fIn\fR\fR
316 312 .ad
317 313 .RS 17n
318 314 True if the file has inode number \fIn\fR.
319 315 .RE
320 316
321 317 .sp
322 318 .ne 2
323 319 .na
324 320 \fB\fB-ipath\fR \fIpattern\fR\fR
325 321 .ad
326 322 .RS 17n
327 323 Like \fB-path\fR, but the match is case insensitive.
328 324 .RE
329 325
330 326 .sp
331 327 .ne 2
332 328 .na
333 329 \fB\fB-iregex\fR \fIpattern\fR\fR
334 330 .ad
335 331 .RS 17n
336 332 Like \fB-regex\fR, but the match is case insensitive.
337 333 .RE
338 334
339 335 .sp
340 336 .ne 2
341 337 .na
342 338 \fB\fB-links\fR \fIn\fR\fR
343 339 .ad
344 340 .RS 17n
345 341 True if the file has \fIn\fR links.
346 342 .RE
347 343
348 344 .sp
349 345 .ne 2
350 346 .na
351 347 \fB\fB-local\fR\fR
352 348 .ad
353 349 .RS 17n
354 350 True if the file system type is not a remote file system type as defined in the
355 351 \fB/etc/dfs/fstypes\fR file. \fBnfs\fR is used as the default remote filesystem
356 352 type if the \fB/etc/dfs/fstypes\fR file is not present. The \fB-local\fR option
357 353 descends the hierarchy of non-local directories. See \fBEXAMPLES\fR for an
358 354 example of how to search for local files without descending.
359 355 .RE
360 356
361 357 .sp
362 358 .ne 2
363 359 .na
364 360 \fB\fB-ls\fR\fR
365 361 .ad
366 362 .RS 17n
367 363 Always true. Prints current pathname together with its associated statistics.
368 364 These include (respectively):
369 365 .RS +4
370 366 .TP
371 367 .ie t \(bu
372 368 .el o
373 369 inode number
374 370 .RE
375 371 .RS +4
376 372 .TP
377 373 .ie t \(bu
378 374 .el o
379 375 size in kilobytes (1024 bytes)
380 376 .RE
381 377 .RS +4
382 378 .TP
383 379 .ie t \(bu
384 380 .el o
385 381 protection mode
386 382 .RE
387 383 .RS +4
388 384 .TP
389 385 .ie t \(bu
390 386 .el o
391 387 number of hard links
392 388 .RE
393 389 .RS +4
394 390 .TP
395 391 .ie t \(bu
396 392 .el o
397 393 user
398 394 .RE
399 395 .RS +4
400 396 .TP
401 397 .ie t \(bu
402 398 .el o
403 399 group
404 400 .RE
405 401 .RS +4
406 402 .TP
407 403 .ie t \(bu
408 404 .el o
409 405 size in bytes
410 406 .RE
411 407 .RS +4
412 408 .TP
413 409 .ie t \(bu
414 410 .el o
415 411 modification time.
416 412 .RE
417 413 If the file is a special file, the size field instead contains the major and
418 414 minor device numbers.
419 415 .sp
420 416 If the file is a symbolic link, the pathname of the linked-to file is printed
421 417 preceded by `\fB\(->\fR\&'. The format is identical to that of \fBls\fR
422 418 \fB-gilds\fR (see \fBls\fR(1B)).
423 419 .sp
424 420 Formatting is done internally, without executing the \fBls\fR program.
425 421 .RE
426 422
427 423 .sp
428 424 .ne 2
429 425 .na
430 426 \fB\fB-maxdepth\fR \fIn\fR\fR
431 427 .ad
432 428 .RS 17n
433 429 Always true; descend at most \fIn\fR directory levels below the command
434 430 line arguments. If any \fB-maxdepth\fR primary is specified, it
435 431 applies to the entire expression even if it would not normally be
436 432 evaluated. \fB-maxdepth 0\fR limits the whole search to
437 433 the command line arguments.
438 434 .RE
439 435
440 436 .sp
441 437 .ne 2
442 438 .na
443 439 \fB\fB-mindepth\fR \fIn\fR\fR
444 440 .ad
445 441 .RS 17n
446 442 Always true; do not apply any tests or actions at levels less
447 443 than \fIn\fR. If any \fB-mindepth\fR primary is specified, it applies to the
448 444 entire expression even if it would not normally be evaluated.
449 445 \fB-mindepth 1\fR processes all but the command line arguments.
450 446 .RE
451 447
452 448 .sp
453 449 .ne 2
454 450 .na
455 451 \fB\fB-mmin\fR \fIn\fR\fR
456 452 .ad
457 453 .RS 17n
458 454 File's data was last modified \fIn\fR minutes ago.
459 455 .RE
460 456
461 457 .sp
462 458 .ne 2
463 459 .na
464 460 \fB\fB-mount\fR\fR
465 461 .ad
466 462 .RS 17n
467 463 Always true. Restricts the search to the file system containing the directory
468 464 specified. Does not list mount points to other file systems.
469 465 .RE
470 466
471 467 .sp
472 468 .ne 2
473 469 .na
474 470 \fB\fB-mtime\fR \fIn\fR\fR
475 471 .ad
476 472 .RS 17n
477 473 True if the file's data was modified \fIn\fR days ago.
478 474 .RE
479 475
480 476 .sp
481 477 .ne 2
482 478 .na
483 479 \fB\fB-name\fR \fIpattern\fR\fR
484 480 .ad
485 481 .RS 17n
486 482 True if \fIpattern\fR matches the basename of the current file name. Normal
487 483 shell file name generation characters (see \fBsh\fR(1)) can be used. A
488 484 backslash (\fB\|\e\|\fR) is used as an escape character within the pattern. The
489 485 pattern should be escaped or quoted when \fBfind\fR is invoked from the shell.
490 486 .sp
491 487 Unless the character '\fB\&.\fR' is explicitly specified in the beginning of
492 488 \fIpattern\fR, a current file name beginning with '\fB\&.\fR' does not match
493 489 \fIpattern\fR when using \fB/usr/bin/find\fR. \fB/usr/xpg4/bin/find\fR does not
494 490 make this distinction; wildcard file name generation characters can match file
495 491 names beginning with '\fB\&.\fR'.
496 492 .RE
497 493
498 494 .sp
499 495 .ne 2
500 496 .na
501 497 \fB\fB-ncpio\fR \fIdevice\fR\fR
502 498 .ad
503 499 .RS 17n
504 500 Always true. Writes the current file on \fIdevice\fR in \fBcpio\fR \fB-c\fR
505 501 format (5120 byte records).
506 502 .RE
507 503
508 504 .sp
509 505 .ne 2
510 506 .na
511 507 \fB\fB-newer\fR \fIfile\fR\fR
512 508 .ad
513 509 .RS 17n
514 510 True if the current file has been modified more recently than the argument
515 511 \fIfile\fR.
516 512 .RE
517 513
518 514 .sp
519 515 .ne 2
520 516 .na
521 517 \fB\fB-nogroup\fR\fR
522 518 .ad
523 519 .RS 17n
524 520 True if the file belongs to non-existing group.
525 521 .RE
526 522
527 523 .sp
528 524 .ne 2
529 525 .na
530 526 \fB\fB-nouser\fR\fR
531 527 .ad
532 528 .RS 17n
533 529 True if the file belongs to non-existing user.
534 530 .RE
535 531
536 532 .sp
537 533 .ne 2
538 534 .na
539 535 \fB\fB-ok\fR \fIcommand\fR\fR
540 536 .ad
541 537 .RS 17n
↓ open down ↓ |
359 lines elided |
↑ open up ↑ |
542 538 Like \fB-exec\fR, except that the generated command line is printed with a
543 539 question mark first, and is executed only if the response is affirmative.
544 540 .RE
545 541
546 542 .sp
547 543 .ne 2
548 544 .na
549 545 \fB\fB-path\fR\fR
550 546 .ad
551 547 .RS 17n
552 -Like \fB-name\fR, but matches the entire file path and not just basename.
548 +Like \fB-name\fR, but matches the entire file path and not just basename, and
549 +without any special treatment of leading periods.
553 550 .RE
554 551
555 552 .sp
556 553 .ne 2
557 554 .na
558 555 \fB\fB-perm\fR [\fB-\fR]\fImode\fR\fR
559 556 .ad
560 557 .RS 17n
561 558 The \fImode\fR argument is used to represent file mode bits. It is identical in
562 559 format to the symbolic mode operand, \fIsymbolic_mode_list\fR, described in
563 560 \fBchmod\fR(1), and is interpreted as follows. To start, a template is assumed
564 561 with all file mode bits cleared. An \fIop\fR symbol of:
565 562 .sp
566 563 .ne 2
567 564 .na
568 565 \fB\fB+\fR\fR
569 566 .ad
570 567 .RS 8n
571 568 Set the appropriate mode bits in the template
572 569 .RE
573 570
574 571 .sp
575 572 .ne 2
576 573 .na
577 574 \fB\fB\(mi\fR\fR
578 575 .ad
579 576 .RS 8n
580 577 Clear the appropriate bits
581 578 .RE
582 579
583 580 .sp
584 581 .ne 2
585 582 .na
586 583 \fB\fB=\fR\fR
587 584 .ad
588 585 .RS 8n
589 586 Set the appropriate mode bits, without regard to the contents of the file mode
590 587 creation mask of the process
591 588 .RE
592 589
593 590 The \fIop\fR symbol of \fB\(mi\fR cannot be the first character of \fImode\fR,
594 591 to avoid ambiguity with the optional leading hyphen. Since the initial mode is
595 592 all bits off, there are no symbolic modes that need to use \fB\(mi\fR as the
596 593 first character.
597 594 .sp
598 595 If the hyphen is omitted, the primary evaluates as true when the file
599 596 permission bits exactly match the value of the resulting template.
600 597 .sp
601 598 Otherwise, if \fImode\fR is prefixed by a hyphen, the primary evaluates as true
602 599 if at least all the bits in the resulting template are set in the file
603 600 permission bits.
604 601 .RE
605 602
606 603 .sp
607 604 .ne 2
608 605 .na
609 606 \fB\fB-perm\fR [\fB-\fR]\fIonum\fR\fR
610 607 .ad
611 608 .RS 17n
612 609 True if the file permission flags exactly match the octal number \fIonum\fR
613 610 (see \fBchmod\fR(1)). If \fIonum\fR is prefixed by a minus sign (\fB\(mi\fR),
614 611 only the bits that are set in \fIonum\fR are compared with the file permission
615 612 flags, and the expression evaluates true if they match.
616 613 .RE
617 614
618 615 .sp
619 616 .ne 2
620 617 .na
621 618 \fB\fB-print\fR\fR
622 619 .ad
623 620 .RS 17n
624 621 Always true. Causes the current pathname to be printed.
625 622 .RE
626 623
627 624 .sp
628 625 .ne 2
629 626 .na
630 627 \fB\fB-print0\fR\fR
631 628 .ad
632 629 .RS 17n
633 630 Always true. Causes the current pathname to be printed, terminated by an ASCII
634 631 NUL character (character code 0) instead of a newline.
635 632 .RE
636 633
637 634 .sp
638 635 .ne 2
639 636 .na
640 637 \fB\fB-prune\fR\fR
641 638 .ad
642 639 .RS 17n
643 640 Always yields true. Does not examine any directories or files in the directory
644 641 structure below the \fIpattern\fR just matched. (See EXAMPLES). If \fB-depth\fR
645 642 is specified, \fB-prune\fR has no effect.
646 643 .RE
647 644
648 645 .sp
649 646 .ne 2
650 647 .na
651 648 \fB\fB-regex\fR \fIpattern\fR\fB
652 649 .ad
653 650 .RS 17n
654 651 True if the full path of the file matches \fIpattern\fR using regular
655 652 expressions.
656 653 .RE
657 654
658 655 .sp
659 656 .ne 2
660 657 .na
661 658 \fB\fB-size\fR \fIn\fR[\fBc\fR]\fR
662 659 .ad
663 660 .RS 17n
664 661 True if the file is \fIn\fR blocks long (512 bytes per block). If \fIn\fR is
665 662 followed by a \fBc\fR, the size is in bytes.
666 663 .RE
667 664
668 665 .sp
669 666 .ne 2
670 667 .na
671 668 \fB\fB-type\fR \fIc\fR\fR
672 669 .ad
673 670 .RS 17n
674 671 True if the type of the file is \fIc\fR, where \fIc\fR is \fBb\fR, \fBc\fR,
675 672 \fBd\fR, \fBD\fR, \fBf\fR, \fBl\fR, \fBp\fR, or \fBs\fR for block special file,
676 673 character special file, directory, door, plain file, symbolic link, fifo (named
677 674 pipe), or socket, respectively.
678 675 .RE
679 676
680 677 .sp
681 678 .ne 2
682 679 .na
683 680 \fB\fB-user\fR \fIuname\fR\fR
684 681 .ad
685 682 .RS 17n
686 683 True if the file belongs to the user \fIuname\fR. If \fIuname\fR is numeric and
687 684 there's no such user name, it is taken as a user \fBID\fR.
688 685 .RE
689 686
690 687 .sp
691 688 .ne 2
692 689 .na
693 690 \fB\fB-useracl\fR \fIuname\fR\fR
694 691 .ad
695 692 .RS 17n
696 693 True if the file's ACL contains an entry for the user \fIuname\fR.
697 694 If \fIuname\fR is numeric and there's no such user name, it is
698 695 taken as a user \fBID\fR.
699 696 .RE
700 697
701 698 .sp
702 699 .ne 2
703 700 .na
704 701 \fB\fB-xdev\fR\fR
705 702 .ad
706 703 .RS 17n
707 704 Same as the \fB-mount\fR primary.
708 705 .RE
709 706
↓ open down ↓ |
147 lines elided |
↑ open up ↑ |
710 707 .sp
711 708 .ne 2
712 709 .na
713 710 \fB\fB-xattr\fR\fR
714 711 .ad
715 712 .RS 17n
716 713 True if the file has extended attributes.
717 714 .RE
718 715
719 716 .SS "Complex Expressions"
720 -.LP
721 717 The primaries can be combined using the following operators (in order of
722 718 decreasing precedence):
723 719 .sp
724 720 .ne 2
725 721 .na
726 722 \fB1)\fB(\fR\fIexpression\fR\fB)\fR\fR
727 723 .ad
728 724 .sp .6
729 725 .RS 4n
730 726 True if the parenthesized expression is true (parentheses are special to the
731 727 shell and must be escaped).
732 728 .RE
733 729
734 730 .sp
735 731 .ne 2
736 732 .na
737 733 \fB2)\fB!\fR\fIexpression\fR\fR
738 734 .ad
739 735 .sp .6
740 736 .RS 4n
741 737 The negation of a primary (\fB!\fR is the unary \fInot\fR operator).
742 738 .RE
743 739
744 740 .sp
745 741 .ne 2
746 742 .na
747 743 \fB3) \fIexpression\fR\fB[\fR\fB-a\fR\fB]\fR \fIexpression\fR\fR
748 744 .ad
749 745 .sp .6
750 746 .RS 4n
751 747 Concatenation of primaries (the \fIand\fR operation is implied by the
752 748 juxtaposition of two primaries).
753 749 .RE
754 750
755 751 .sp
756 752 .ne 2
757 753 .na
758 754 \fB4) \fIexpression\fR\fB\fR\fB-o\fR\fIexpression\fR\fR
759 755 .ad
760 756 .sp .6
761 757 .RS 4n
762 758 Alternation of primaries (\fB-o\fR is the \fIor\fR operator).
763 759 .RE
764 760
765 761 .sp
766 762 .LP
767 763 When you use \fBfind\fR in conjunction with \fBcpio\fR, if you use the \fB-L\fR
768 764 option with \fBcpio\fR, you must use the \fB-L\fR option or the \fB-follow\fR
769 765 primitive with \fBfind\fR and vice versa. Otherwise the results are
770 766 unspecified.
771 767 .sp
772 768 .LP
773 769 If no \fIexpression\fR is present, \fB-print\fR is used as the expression.
774 770 Otherwise, if the specified expression does not contain any of the primaries
775 771 \fB-exec\fR, \fB-ok\fR, \fB-ls\fR, or \fB-print\fR, the specified expression is
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
776 772 effectively replaced by:
777 773 .sp
778 774 .LP
779 775 (\fIspecified\fR) \fB-print\fR
780 776 .sp
781 777 .LP
782 778 The \fB-user\fR, \fB-group\fR, and \fB-newer\fR primaries each evaluate their
783 779 respective arguments only once. Invocation of \fIcommand\fR specified by
784 780 \fB-exec\fR or \fB-ok\fR does not affect subsequent primaries on the same file.
785 781 .SH USAGE
786 -.LP
787 782 See \fBlargefile\fR(5) for the description of the behavior of \fBfind\fR when
788 783 encountering files greater than or equal to 2 Gbyte (2^31 bytes).
789 784 .SH EXAMPLES
790 -.LP
791 785 \fBExample 1 \fRWriting Out the Hierarchy Directory
792 786 .sp
793 787 .LP
794 788 The following commands are equivalent:
795 789
796 790 .sp
797 791 .in +2
798 792 .nf
799 793 example% \fBfind .\fR
800 794 example% \fBfind . -print\fR
801 795 .fi
802 796 .in -2
803 797 .sp
804 798
805 799 .sp
806 800 .LP
807 801 They both write out the entire directory hierarchy from the current directory.
808 802
809 803 .LP
810 804 \fBExample 2 \fRRemoving Files
811 805 .sp
812 806 .LP
813 807 The following command removes all files in your home directory named \fBa.out\fR
814 808 or \fB*.o\fR that have not been accessed for a week:
815 809
816 810 .sp
817 811 .in +2
818 812 .nf
819 813 example% \fBfind $HOME \e( -name a.out -o -name '*.o' \e) \e
820 814 -atime +7 -exec rm {} \e;\fR
821 815 .fi
822 816 .in -2
823 817 .sp
824 818
825 819 .LP
826 820 \fBExample 3 \fRPrinting All File Names But Skipping SCCS Directories
827 821 .sp
828 822 .LP
829 823 The following command recursively print all file names in the current directory
830 824 and below, but skipping \fBSCCS\fR directories:
831 825
832 826 .sp
833 827 .in +2
834 828 .nf
835 829 example% \fBfind . -name SCCS -prune -o -print\fR
836 830 .fi
837 831 .in -2
838 832 .sp
839 833
840 834 .LP
841 835 \fBExample 4 \fRPrinting all file names and the SCCS directory name
842 836 .sp
843 837 .LP
844 838 Recursively print all file names in the current directory and below, skipping
845 839 the contents of \fBSCCS\fR directories, but printing out the \fBSCCS\fR
846 840 directory name:
847 841
848 842 .sp
849 843 .in +2
850 844 .nf
851 845 example% \fBfind . -print -name SCCS -prune\fR
852 846 .fi
853 847 .in -2
854 848 .sp
855 849
856 850 .LP
857 851 \fBExample 5 \fRTesting for the Newer File
858 852 .sp
859 853 .LP
860 854 The following command is basically equivalent to the \fB-nt\fR extension to
861 855 \fBtest\fR(1):
862 856
863 857 .sp
864 858 .in +2
865 859 .nf
866 860 example$ \fBif [ -n "$(find
867 861 file1 -prune -newer file2)" ]; then
868 862
869 863 printf %s\e\en "file1 is newer than file2"\fR
870 864 .fi
871 865 .in -2
872 866 .sp
873 867
874 868 .LP
875 869 \fBExample 6 \fRSelecting a File Using 24-hour Mode
876 870 .sp
877 871 .LP
878 872 The descriptions of \fB-atime\fR, \fB-ctime\fR, and \fB-mtime\fR use the
879 873 terminology \fIn\fR ``24-hour periods''. For example, a file accessed at 23:59
880 874 is selected by:
881 875
882 876 .sp
883 877 .in +2
884 878 .nf
885 879 example% \fBfind . -atime -1 -print\fR
886 880 .fi
887 881 .in -2
888 882 .sp
889 883
890 884 .sp
891 885 .LP
892 886 at 00:01 the next day (less than 24 hours later, not more than one day ago).
893 887 The midnight boundary between days has no effect on the 24-hour calculation.
894 888
895 889 .LP
896 890 \fBExample 7 \fRPrinting Files Matching a User's Permission Mode
897 891 .sp
898 892 .LP
899 893 The following command recursively print all file names whose permission mode
900 894 exactly matches read, write, and execute access for user, and read and execute
901 895 access for group and other:
902 896
903 897 .sp
904 898 .in +2
905 899 .nf
906 900 example% \fBfind . -perm u=rwx,g=rx,o=rx\fR
907 901 .fi
908 902 .in -2
909 903 .sp
910 904
911 905 .sp
912 906 .LP
913 907 The above could alternatively be specified as follows:
914 908
915 909 .sp
916 910 .in +2
917 911 .nf
918 912 example% \fBfind . -perm a=rwx,g-w,o-w\fR
919 913 .fi
920 914 .in -2
921 915 .sp
922 916
923 917 .LP
924 918 \fBExample 8 \fRPrinting Files with Write Access for \fBother\fR
925 919 .sp
926 920 .LP
927 921 The following command recursively print all file names whose permission
928 922 includes, but is not limited to, write access for other:
929 923
930 924 .sp
931 925 .in +2
932 926 .nf
933 927 example% \fBfind . -perm -o+w\fR
934 928 .fi
935 929 .in -2
936 930 .sp
937 931
938 932 .LP
939 933 \fBExample 9 \fRPrinting Local Files without Descending Non-local Directories
940 934 .sp
941 935 .in +2
942 936 .nf
943 937 example% \fBfind . ! -local -prune -o -print\fR
944 938 .fi
945 939 .in -2
946 940 .sp
947 941
948 942 .LP
949 943 \fBExample 10 \fRPrinting the Files in the Name Space Possessing Extended
↓ open down ↓ |
149 lines elided |
↑ open up ↑ |
950 944 Attributes
951 945 .sp
952 946 .in +2
953 947 .nf
954 948 example% \fBfind . -xattr\fR
955 949 .fi
956 950 .in -2
957 951 .sp
958 952
959 953 .SH ENVIRONMENT VARIABLES
960 -.LP
961 954 See \fBenviron\fR(5) for descriptions of the following environment variables
962 955 that affect the execution of \fBfind\fR: \fBLANG\fR, \fBLC_ALL\fR,
963 956 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
964 957 .sp
965 958 .ne 2
966 959 .na
967 960 \fB\fBPATH\fR\fR
968 961 .ad
969 962 .RS 8n
970 963 Determine the location of the \fIutility_name\fR for the \fB-exec\fR and
971 964 \fB-ok\fR primaries.
972 965 .RE
973 966
974 967 .sp
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
975 968 .LP
976 969 Affirmative responses are processed using the extended regular expression
977 970 defined for the \fByesexpr\fR keyword in the \fBLC_MESSAGES\fR category of the
978 971 user's locale. The locale specified in the \fBLC_COLLATE\fR category defines
979 972 the behavior of ranges, equivalence classes, and multi-character collating
980 973 elements used in the expression defined for \fByesexpr\fR. The locale specified
981 974 in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of
982 975 bytes of text data a characters, the behavior of character classes used in the
983 976 expression defined for the \fByesexpr\fR. See \fBlocale\fR(5).
984 977 .SH EXIT STATUS
985 -.LP
986 978 The following exit values are returned:
987 979 .sp
988 980 .ne 2
989 981 .na
990 982 \fB\fB0\fR\fR
991 983 .ad
992 984 .RS 6n
993 985 All \fIpath\fR operands were traversed successfully.
994 986 .RE
995 987
996 988 .sp
997 989 .ne 2
998 990 .na
999 991 \fB\fB>0\fR\fR
1000 992 .ad
1001 993 .RS 6n
1002 994 An error occurred.
1003 995 .RE
1004 996
1005 997 .SH FILES
1006 998 .ne 2
1007 999 .na
1008 1000 \fB\fB/etc/passwd\fR\fR
1009 1001 .ad
1010 1002 .RS 20n
1011 1003 Password file
1012 1004 .RE
1013 1005
1014 1006 .sp
1015 1007 .ne 2
1016 1008 .na
1017 1009 \fB\fB/etc/group\fR\fR
1018 1010 .ad
1019 1011 .RS 20n
1020 1012 Group file
1021 1013 .RE
1022 1014
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
1023 1015 .sp
1024 1016 .ne 2
1025 1017 .na
1026 1018 \fB\fB/etc/dfs/fstypes\fR\fR
1027 1019 .ad
1028 1020 .RS 20n
1029 1021 File that registers distributed file system packages
1030 1022 .RE
1031 1023
1032 1024 .SH ATTRIBUTES
1033 -.LP
1034 1025 See \fBattributes\fR(5) for descriptions of the following attributes:
1035 1026 .sp
1036 1027
1037 1028 .sp
1038 1029 .TS
1039 1030 box;
1040 1031 c | c
1041 1032 l | l .
1042 1033 ATTRIBUTE TYPE ATTRIBUTE VALUE
1043 1034 _
1044 1035 CSI Enabled
1045 1036 _
1046 1037 Interface Stability Committed
1047 1038 _
1048 1039 Standard See \fBstandards\fR(5).
1049 1040 .TE
1050 1041
1051 1042 .SH SEE ALSO
1052 -.LP
1053 1043 \fBchmod\fR(1), \fBcpio\fR(1), \fBsh\fR(1), \fBtest\fR(1), \fBls\fR(1B),
1054 1044 \fBacl\fR(5), \fBregex\fR(5), \fBstat\fR(2), \fBumask\fR(2),
1055 1045 \fBattributes\fR(5), \fBenviron\fR(5), \fBfsattr\fR(5), \fBlargefile\fR(5),
1056 1046 \fBlocale\fR(5), \fBstandards\fR(5)
1057 1047 .SH WARNINGS
1058 -.LP
1059 1048 The following options are obsolete and will not be supported in future
1060 1049 releases:
1061 1050 .sp
1062 1051 .ne 2
1063 1052 .na
1064 1053 \fB\fB-cpio\fR \fIdevice\fR\fR
1065 1054 .ad
1066 1055 .RS 17n
1067 1056 Always true. Writes the current file on \fIdevice\fR in \fBcpio\fR format
1068 1057 (5120-byte records).
1069 1058 .RE
1070 1059
1071 1060 .sp
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
1072 1061 .ne 2
1073 1062 .na
1074 1063 \fB\fB-ncpio\fR \fIdevice\fR\fR
1075 1064 .ad
1076 1065 .RS 17n
1077 1066 Always true. Writes the current file on \fIdevice\fR in \fBcpio\fR \fB-c\fR
1078 1067 format (5120-byte records).
1079 1068 .RE
1080 1069
1081 1070 .SH NOTES
1082 -.LP
1083 1071 When using \fBfind\fR to determine files modified within a range of time, use
1084 1072 the \fB-mtime\fR argument \fBbefore\fR the \fB-print\fR argument. Otherwise,
1085 1073 \fBfind\fR gives all files.
1086 1074 .sp
1087 1075 .LP
1088 1076 Some files that might be under the Solaris root file system are actually mount
1089 1077 points for virtual file systems, such as \fBmntfs\fR or \fBnamefs\fR. When
1090 1078 comparing against a \fBufs\fR file system, such files are not selected if
1091 1079 \fB-mount\fR or \fB-xdev\fR is specified in the \fBfind\fR expression.
1092 1080 .sp
1093 1081 .LP
1094 1082 Using the \fB-L\fR or \fB-follow\fR option is not recommended when descending a
1095 1083 file-system hierarchy that is under the control of other users. In particular,
1096 1084 when using \fB-exec\fR, symbolic links can lead the \fBfind\fR command out of
1097 1085 the hierarchy in which it started. Using \fB-type\fR is not sufficient to
1098 1086 restrict the type of files on which the \fB-exec\fR command operates, because
1099 1087 there is an inherent race condition between the type-check performed by the
1100 1088 \fBfind\fR command and the time the executed command operates on the file
1101 1089 argument.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX