|
|
1.1 root 1: .\" Copyright (c) 1985 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)find.1 6.4 (Berkeley) 7/21/88
6: .\"
7: .TH FIND 1 "July 21, 1988"
8: .AT 3
9: .SH NAME
10: find \- find files
11: .SH SYNOPSIS
12: .B find
13: pathname-list expression
14: .br
15: .B find
16: pattern
17: .SH DESCRIPTION
18: In the first form above,
19: .I find
20: recursively descends
21: the directory hierarchy for
22: each pathname in the
23: .I pathname-list
24: (i.e., one or more pathnames)
25: seeking files that match a boolean
26: .I expression
27: written in the primaries given below.
28: In the descriptions, the argument
29: .I n
30: is used as a decimal integer
31: where
32: .I +n
33: means more than
34: .I n,
35: .I \-n
36: means less than
37: .I n
38: and
39: .I n
40: means exactly
41: .IR n .
42: .PP
43: The second form rapidly searches a database for all pathnames
44: which match
45: .IR pattern .
46: Usually the database is recomputed
47: weekly and contains the pathnames
48: of all files which are publicly accessible.
49: If escaped, normal shell
50: \*(lqglobbing\*(rq characters (`*', `?', `[', and ']')
51: may be used in
52: .IR pattern ,
53: but the matching differs in that no characters
54: .RI ( e.g. " `/')"
55: have to be matched explicitly.
56: As a special case, a simple
57: .I pattern
58: containing no globbing characters
59: is matched as though it were
60: .IR *pattern* ;
61: if any globbing character appears
62: there are no implicit globbing characters.
63: .TP 10n
64: .BR \-name " filename"
65: True if the
66: .I filename
67: argument matches the current file name.
68: Normal
69: shell
70: argument syntax may be used if escaped (watch out for
71: `[', `?' and `*').
72: .TP
73: .BR \-perm " onum"
74: True if the file permission flags
75: exactly
76: match the
77: octal number
78: .I onum
79: (see
80: .IR chmod (1)).
81: If
82: .I onum
83: is prefixed by a minus sign,
84: more flag bits (017777, see
85: .IR stat (2))
86: become significant and
87: the flags are compared:
88: .IR (flags&onum)==onum .
89: .TP
90: .BR \-type " c"
91: True if the type of the file
92: is
93: .I c,
94: where
95: .I c
96: is
97: .B "b, c, d, f, l"
98: or
99: .B s
100: for
101: block special file, character special file,
102: directory, plain file, symbolic link, or socket.
103: .TP
104: .BR \-links " n"
105: True if the file has
106: .I n
107: links.
108: .TP
109: .BR \-user " uname"
110: True if the file belongs to the user
111: .I uname
112: (login name or numeric user ID).
113: .TP
114: .B \-nouser
115: True if the file belongs to a user
116: .I not
117: in the /etc/passwd database.
118: .TP
119: .BR \-group " gname"
120: True if the file belongs to group
121: .I gname
122: (group name or numeric group ID).
123: .TP
124: .B \-nogroup
125: True if the file belongs to a group
126: .I not
127: in the /etc/group database.
128: .TP
129: .BR \-size " n"
130: True if the file is
131: .I n
132: blocks long (512 bytes per block).
133: .TP
134: .BR \-inum " n"
135: True if the file has inode number
136: .I n.
137: .TP
138: .BR \-atime " n"
139: True if the file has been accessed in
140: .I n
141: days.
142: .TP
143: .BR \-mtime " n"
144: True if the file has been modified in
145: .I n
146: days.
147: .TP
148: .BR \-exec " command"
149: True if the executed command returns
150: a zero value as exit status.
151: The end of the command must be punctuated by an escaped
152: semicolon.
153: A command argument `{}' is replaced by the
154: current pathname.
155: .TP
156: .BR \-ok " command"
157: Like
158: .B \-exec
159: except that the generated command is written on
160: the standard output, then the standard input is read
161: and the command executed only upon response
162: .BR y .
163: .TP
164: .B \-print
165: Always true;
166: causes the current pathname to be printed.
167: .TP
168: .B \-ls
169: Always true;
170: causes current pathname to be printed together
171: with its associated statistics.
172: These include (respectively) inode number,
173: size in kilobytes (1024 bytes),
174: protection mode,
175: number of hard links,
176: user,
177: group,
178: size in bytes,
179: and modification time.
180: If the file is a special file
181: the size field will instead contain the major and minor
182: device numbers.
183: If the file is a symbolic link the
184: pathname of the linked-to file is printed preceded by ``->''.
185: The format is identical to that of ``ls -gilds''
186: (note however that formatting is done internally,
187: without executing the ls program).
188: .TP
189: .BR \-newer " file"
190: True if
191: the current file has been modified more recently than the argument
192: .I file.
193: .TP
194: .BR \-cpio " file"
195: Write the current file on the argument
196: .I file
197: in
198: .I cpio
199: format.
200: .TP
201: .B \-xdev
202: Always true;
203: causes find
204: .I not
205: to traverse down into a file system different
206: from the one on which current
207: .I argument
208: pathname resides.
209: .TP
210: .B \-follow
211: Always true;
212: causes find to traverse symbolic links to directories.
213: Normally find does not traverse symbolic links.
214: .PP
215: The primaries may be combined using the following operators
216: (in order of decreasing precedence):
217: .TP 4
218: 1)
219: A parenthesized group of primaries and operators
220: (parentheses are special to the Shell and must be escaped).
221: .TP 4
222: 2)
223: The negation of a primary
224: (`!' is the unary
225: .I not
226: operator).
227: .TP 4
228: 3)
229: Concatenation of primaries
230: (the
231: .I and
232: operation
233: is implied by the juxtaposition of two primaries).
234: .TP 4
235: 4)
236: Alternation of primaries
237: .RB "(`" \-o "' is the"
238: .I or
239: operator).
240: .SH EXAMPLES
241: .PP
242: To find all accessible files whose pathname contains `find':
243: .IP
244: find find
245: .PP
246: To typeset all variants of manual pages for `ls':
247: .IP
248: vtroff -man `find '*man*/ls.?'`
249: .PP
250: To remove all files named
251: `a.out' or `*.o' that have not been accessed for a week:
252: .IP "" .2i
253: find / \e( \-name a.out \-o \-name '*.o' \e) \-atime +7 \-exec rm {} \e\;
254: .SH FILES
255: .nf
256: .ta \w'/usr/lib/find/find.codes 'u
257: /etc/passwd
258: /etc/group
259: /usr/lib/find/find.codes coded pathnames database
260: .fi
261: .SH "SEE ALSO"
262: sh(1), test(1), fs(5)
263: .br
264: Relevant paper in February, 1983 issue of
265: .I ;login:.
266: .SH BUGS
267: The first form's syntax is painful, and
268: the second form's exact semantics is confusing and
269: can vary from site to site.
270: .PP
271: More than one `-newer' option does not work properly.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.