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