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