Commit | Line | Data |
---|---|---|
e6817382 BJ |
1 | .TH FIND 1 |
2 | .SH NAME | |
3 | find \- find files | |
4 | .SH SYNOPSIS | |
5 | .B find | |
6 | pathname-list expression | |
7 | .SH DESCRIPTION | |
8 | .I Find | |
9 | recursively descends | |
10 | the directory hierarchy for | |
11 | each pathname in the | |
12 | .I pathname-list | |
13 | (i.e., one or more pathnames) | |
14 | seeking files that match a boolean | |
15 | .I expression | |
16 | written in the primaries given below. | |
17 | In the descriptions, the argument | |
18 | .I n | |
19 | is used as a decimal integer | |
20 | where | |
21 | .I +n | |
22 | means more than | |
23 | .I n, | |
24 | .I \-n | |
25 | means less than | |
26 | .I n | |
27 | and | |
28 | .I n | |
29 | means exactly | |
30 | .IR n . | |
31 | .TP 10n | |
32 | .BR \-name " filename" | |
33 | True if the | |
34 | .I filename | |
35 | argument matches the current file name. | |
36 | Normal | |
37 | Shell | |
38 | argument syntax may be used if escaped (watch out for | |
39 | `[', `?' and `*'). | |
40 | .TP | |
41 | .BR \-perm " onum" | |
42 | True if the file permission flags | |
43 | exactly | |
44 | match the | |
45 | octal number | |
46 | .I onum | |
47 | (see | |
48 | .IR chmod (1)). | |
49 | If | |
50 | .I onum | |
51 | is prefixed by a minus sign, | |
52 | more flag bits (017777, see | |
53 | .IR stat (2)) | |
54 | become significant and | |
55 | the flags are compared: | |
56 | .IR (flags&onum)==onum . | |
57 | .TP | |
58 | .BR \-type " c" | |
59 | True if the type of the file | |
60 | is | |
61 | .I c, | |
62 | where | |
63 | .I c | |
64 | is | |
65 | .B "b, c, d" | |
66 | or | |
67 | .B f | |
68 | for | |
69 | block special file, character special file, | |
70 | directory or plain file. | |
71 | .TP | |
72 | .BR \-links " n" | |
73 | True if the file has | |
74 | .I n | |
75 | links. | |
76 | .TP | |
77 | .BR \-user " uname" | |
78 | True if the file belongs to the user | |
79 | .I uname | |
80 | (login name or numeric user ID). | |
81 | .TP | |
82 | .BR \-group " gname" | |
83 | True if the file belongs to group | |
84 | .I gname | |
85 | (group name or numeric group ID). | |
86 | .TP | |
87 | .BR \-size " n" | |
88 | True if the file is | |
89 | .I n | |
90 | blocks long (512 bytes per block). | |
91 | .TP | |
92 | .BR \-inum " n" | |
93 | True if the file has inode number | |
94 | .I n. | |
95 | .TP | |
96 | .BR \-atime " n" | |
97 | True if the file has been accessed in | |
98 | .I n | |
99 | days. | |
100 | .TP | |
101 | .BR \-mtime " n" | |
102 | True if the file has been modified in | |
103 | .I n | |
104 | days. | |
105 | .TP | |
106 | .BR \-exec " command" | |
107 | True if the executed command returns | |
108 | a zero value as exit status. | |
109 | The end of the command must be punctuated by an escaped | |
110 | semicolon. | |
111 | A command argument `{}' is replaced by the | |
112 | current pathname. | |
113 | .TP | |
114 | .BR \-ok " command" | |
115 | Like | |
116 | .B \-exec | |
117 | except that the generated command is written on | |
118 | the standard output, then the standard input is read | |
119 | and the command executed only upon response | |
120 | .BR y . | |
121 | .TP | |
122 | .B \-print | |
123 | Always true; | |
124 | causes the current pathname to be printed. | |
125 | .TP | |
126 | .BR \-newer " file" | |
127 | True if | |
128 | the current file has been modified more recently than the argument | |
129 | .I file. | |
130 | .PP | |
131 | The primaries may be combined using the following operators | |
132 | (in order of decreasing precedence): | |
133 | .TP 4 | |
134 | 1) | |
135 | A parenthesized group of primaries and operators | |
136 | (parentheses are special to the Shell and must be escaped). | |
137 | .TP 4 | |
138 | 2) | |
139 | The negation of a primary | |
140 | (`!' is the unary | |
141 | .I not | |
142 | operator). | |
143 | .TP 4 | |
144 | 3) | |
145 | Concatenation of primaries | |
146 | (the | |
147 | .I and | |
148 | operation | |
149 | is implied by the juxtaposition of two primaries). | |
150 | .TP 4 | |
151 | 4) | |
152 | Alternation of primaries | |
153 | .RB "(`" \-o "' is the" | |
154 | .I or | |
155 | operator). | |
156 | .SH EXAMPLE | |
157 | To remove all files named | |
158 | `a.out' or `*.o' that have not been accessed for a week: | |
159 | .IP "" .2i | |
160 | find / \\( \-name a.out \-o \-name '*.o' \\) | |
161 | \-atime +7 \-exec rm {} \\; | |
162 | .SH FILES | |
163 | /etc/passwd | |
164 | .br | |
165 | /etc/group | |
166 | .SH "SEE ALSO" | |
167 | sh(1), test(1), filsys(5) | |
168 | .SH BUGS | |
169 | The syntax is painful. |