1 | .TH FIND 1
|
---|
2 | .SH NAME
|
---|
3 | find \- find files meeting a given condition
|
---|
4 | .SH SYNOPSIS
|
---|
5 | \fBfind \fIdirectory \fIexpression\fR
|
---|
6 | .br
|
---|
7 | .de FL
|
---|
8 | .TP
|
---|
9 | \\fB\\$1\\fR
|
---|
10 | \\$2
|
---|
11 | ..
|
---|
12 | .de EX
|
---|
13 | .TP 20
|
---|
14 | \\fB\\$1\\fR
|
---|
15 | # \\$2
|
---|
16 | ..
|
---|
17 | .SH EXAMPLES
|
---|
18 | .EX "find / \-name a.out \-print" "Print all \fIa.out\fR paths"
|
---|
19 | .EX "find /usr/ast ! \-newer f \-ok rm {} \e;" "Ask before removing"
|
---|
20 | .EX "find /usr \-size +20 \-exec mv {} /big \e^;" "move files > 10k"
|
---|
21 | .EX "find / \e( \-name a.out \-o \-name \(fm*.o\(fm \e) \-exec rm {} \e;" "2 conds"
|
---|
22 | .SH DESCRIPTION
|
---|
23 | .PP
|
---|
24 | \fIFind\fR descends the file tree starting at the given directory checking
|
---|
25 | each file in that directory and its subdirectories against a predicate.
|
---|
26 | If the predicate is true, an action is taken. The predicates may be
|
---|
27 | connected by \fB\-a\fR (Boolean and), \fB\-o\fR (Boolean or) and !
|
---|
28 | (Boolean negation).
|
---|
29 | Each predicate is true under the conditions specified below. The integer
|
---|
30 | \fIn\fR may also be +\fIn\fR to mean any value greater than \fIn\fR,
|
---|
31 | \fI\-n\fR to mean any value less than
|
---|
32 | \fIn\fR, or just \fIn\fR for exactly \fIn\fR.
|
---|
33 | .PP
|
---|
34 | .RS
|
---|
35 | .ta +\w'\-mtime nmm'u
|
---|
36 | .in +\w'\-mtime nmm'u
|
---|
37 | .ti -\w'\-mtime nmm'u
|
---|
38 | \-name s true if current filename is \fIs\fR (include shell wild cards)
|
---|
39 | .ti -\w'\-mtime nmm'u
|
---|
40 | \-size n true if file size is \fIn\fR blocks
|
---|
41 | .ti -\w'\-mtime nmm'u
|
---|
42 | \-inum n true if the current file's i-node number is \fIn\fR
|
---|
43 | .ti -\w'\-mtime nmm'u
|
---|
44 | \-mtime n true if modification time relative to today (in days) is \fIn\fR
|
---|
45 | .ti -\w'\-mtime nmm'u
|
---|
46 | \-links n true if the number of links to the file is \fIn\fR
|
---|
47 | .ti -\w'\-mtime nmm'u
|
---|
48 | \-newer f true if the file is newer than \fIf\fR
|
---|
49 | .ti -\w'\-mtime nmm'u
|
---|
50 | \-perm n true if the file's permission bits = \fIn\fR (\fIn\fR is in octal)
|
---|
51 | .ti -\w'\-mtime nmm'u
|
---|
52 | \-user u true if the uid = \fIu\fR (a numerical value, not a login name)
|
---|
53 | .ti -\w'\-mtime nmm'u
|
---|
54 | \-group g true if the gid = \fIg\fR (a numerical value, not a group name)
|
---|
55 | .ti -\w'\-mtime nmm'u
|
---|
56 | \-type x where \fIx\fR is \fBbcdfug\fR (block, char, dir, regular file, setuid, setgid)
|
---|
57 | .ti -\w'\-mtime nmm'u
|
---|
58 | \-xdev do not cross devices to search mounted file systems
|
---|
59 | .in -\w'\-mtime nmm'u
|
---|
60 | .fi
|
---|
61 | .RE
|
---|
62 | .PP
|
---|
63 | Following the expression can be one of the following, telling what to do
|
---|
64 | when a file is found:
|
---|
65 | .PP
|
---|
66 | .RS
|
---|
67 | .ta +\w'\-mtime nmm'u
|
---|
68 | .in +\w'\-mtime nmm'u
|
---|
69 | .ti -\w'\-mtime nmm'u
|
---|
70 | \-print print the file name on standard output
|
---|
71 | .ti -\w'\-mtime nmm'u
|
---|
72 | \-print0 print the file name terminated by a null character, to be
|
---|
73 | used with
|
---|
74 | .BR "xargs \-0" .
|
---|
75 | (MINIX 3 extension).
|
---|
76 | .ti -\w'\-mtime nmm'u
|
---|
77 | \-exec execute a command, {} stands for the file name
|
---|
78 | .ti -\w'\-mtime nmm'u
|
---|
79 | \-ok prompts before executing the command
|
---|
80 | .in -\w'\-mtime nmm'u
|
---|
81 | .RE
|
---|
82 | .SH "SEE ALSO"
|
---|
83 | .BR test (1),
|
---|
84 | .BR xargs (1).
|
---|