|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-215D2BD2-1757-5869-A589-98BE332EB4E2" xml:lang="en"><title>find</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
13 <p><userinput>find [-d | -s ] [pathname ...] expression</userinput> </p> |
|
14 <p>The <codeph>find</codeph> command recursively descends the directory tree |
|
15 for each pathname listed, evaluating an expression (composed of the <b>Primaries</b> and <b>Operands</b> listed |
|
16 in the following sections) in terms of each file in the tree. </p> |
|
17 <p>The <codeph>find</codeph> command supports the following options: </p> |
|
18 <table id="GUID-B4D4105E-188A-51CB-A7AC-C88BCC474DD5"> |
|
19 <tgroup cols="2"><colspec colname="col0" colwidth="0.42*"/><colspec colname="col1" colwidth="1.58*"/> |
|
20 <thead> |
|
21 <row> |
|
22 <entry><p><b>Option</b></p></entry> |
|
23 <entry><p><b>Description</b></p></entry> |
|
24 </row> |
|
25 </thead> |
|
26 <tbody> |
|
27 <row> |
|
28 <entry><p> <codeph>-d</codeph> </p> </entry> |
|
29 <entry><p>Cause <codeph>find</codeph> to perform a depth-first traversal, |
|
30 that is directories are visited in post-order and all entries in a directory |
|
31 will be acted on before the directory itself. By default, <codeph>find</codeph> visits |
|
32 directories in pre-order, that is before their contents. </p> </entry> |
|
33 </row> |
|
34 <row> |
|
35 <entry><p> <codeph>-s</codeph> </p> </entry> |
|
36 <entry><p>Cause <codeph>find</codeph> to traverse the file hierarchies in |
|
37 lexicographical order, that is alphabetical order within each directory. </p> <p> <b>Notes:</b> </p> <ul> |
|
38 <li id="GUID-EC32CF84-4AA1-5803-9D9C-6E5DAB1B646D"><p>The <codeph>find -s</codeph> and <codeph>find |
|
39 | sort</codeph> commands may give different results. </p> </li> |
|
40 <li id="GUID-F90A1413-0E6D-5E8B-A999-30577E647E8E"><p>When the <codeph>-d</codeph> and <codeph>-s</codeph> options |
|
41 are not used, the <codeph>find</codeph> command traverses the directory in |
|
42 pre-order, that is the directories will be listed first followed by the files |
|
43 in that directory. </p> </li> |
|
44 </ul> </entry> |
|
45 </row> |
|
46 </tbody> |
|
47 </tgroup> |
|
48 </table> |
|
49 <p> <b>Note:</b> For more information about using the <codeph>find</codeph> command, |
|
50 search <xref href="http://www.freebsd.org/cgi/man.cgi" scope="external">http://www.freebsd.org/cgi/man.cgi</xref> by |
|
51 specifying <codeph>find</codeph> as the search keyword and selecting the <b>FreeBSD |
|
52 6.2-Release</b> option from the release list. </p> |
|
53 <section><title>Primaries</title> <p>The following primaries are supported |
|
54 by the <codeph>find</codeph> command: </p> <table id="GUID-57FEB8A9-6307-52C9-A151-11EA1AC43494"> |
|
55 <tgroup cols="2"><colspec colname="col0" colwidth="0.42*"/><colspec colname="col1" colwidth="1.58*"/> |
|
56 <thead> |
|
57 <row> |
|
58 <entry><p><b>Primary</b></p></entry> |
|
59 <entry><p><b>Description</b></p></entry> |
|
60 </row> |
|
61 </thead> |
|
62 <tbody> |
|
63 <row> |
|
64 <entry><p> <codeph>-amin n</codeph> </p> </entry> |
|
65 <entry><p>True if the difference between the file last access time and the |
|
66 time <codeph>find</codeph> was started, rounded up to the next full minute, |
|
67 is <codeph>n</codeph> minutes. </p> </entry> |
|
68 </row> |
|
69 <row> |
|
70 <entry><p> <codeph>-anewer file</codeph> </p> </entry> |
|
71 <entry><p>File was last accessed more recently than file was modified. </p> </entry> |
|
72 </row> |
|
73 <row> |
|
74 <entry><p> <codeph>-atime n</codeph> </p> </entry> |
|
75 <entry><p>If no units are specified, this primary evaluates to true if the |
|
76 difference between the file last access time and the time <codeph>find</codeph> was |
|
77 started, rounded up to the next full 24-hour period, is <codeph>n</codeph> 24-hour |
|
78 periods. </p> </entry> |
|
79 </row> |
|
80 <row> |
|
81 <entry><p> <codeph>-cmin n</codeph> </p> </entry> |
|
82 <entry><p>True if the difference between the time of last change of file status |
|
83 information and the time <codeph>find</codeph> was started, rounded up to |
|
84 the next full minute, is <codeph>n</codeph> minutes. </p> </entry> |
|
85 </row> |
|
86 <row> |
|
87 <entry><p> <codeph>-cnewer file</codeph> </p> </entry> |
|
88 <entry><p>True if the current file has been changed more recently than the |
|
89 changed time of the file named by the pathname file. </p> </entry> |
|
90 </row> |
|
91 <row> |
|
92 <entry><p> <codeph>-ctime n</codeph> </p> </entry> |
|
93 <entry><p>If no units are specified, this primary evaluates to true if the |
|
94 difference between the time of last change of file status information and |
|
95 the time <codeph>find</codeph> was started, rounded up to the next full 24-hour |
|
96 period, is <codeph>n</codeph> 24-hour periods. </p> </entry> |
|
97 </row> |
|
98 <row> |
|
99 <entry><p> <codeph>-delete</codeph> </p> </entry> |
|
100 <entry><p>Deletes the files specified as an argument to the <codeph>delete</codeph> option. </p> </entry> |
|
101 </row> |
|
102 <row> |
|
103 <entry><p> <codeph>-depth </codeph> </p> </entry> |
|
104 <entry><p>Always true. This option is similar to the <codeph>-d</codeph> option. </p> </entry> |
|
105 </row> |
|
106 <row> |
|
107 <entry><p> <codeph>-empty </codeph> </p> </entry> |
|
108 <entry><p>True if the current file or directory is empty. </p> </entry> |
|
109 </row> |
|
110 <row> |
|
111 <entry><p> <codeph>-exec utility [argument ...] {} +</codeph> </p> </entry> |
|
112 <entry><p>The primary evaluates as true if the invoked utility returns a zero |
|
113 value as exit status. </p> </entry> |
|
114 </row> |
|
115 <row> |
|
116 <entry><p> <codeph>-iname pattern</codeph> </p> </entry> |
|
117 <entry><p>This option is similar to <codeph>-name</codeph>, but the match |
|
118 is case insensitive. </p> </entry> |
|
119 </row> |
|
120 <row> |
|
121 <entry><p> <codeph>-links n</codeph> </p> </entry> |
|
122 <entry><p>True if the file has <codeph>n</codeph> links. </p> </entry> |
|
123 </row> |
|
124 <row> |
|
125 <entry><p> <codeph>-ls </codeph> </p> </entry> |
|
126 <entry><p>This primary always evaluates to true. The following information |
|
127 for the current file is written to standard output; inode number, size in |
|
128 512-byte blocks, file permissions, number of hard link, size in bytes, last |
|
129 modification time, and pathname. </p> </entry> |
|
130 </row> |
|
131 <row> |
|
132 <entry><p> <codeph>-maxdepth n</codeph> </p> </entry> |
|
133 <entry><p>Always true; descend at most <codeph>n</codeph> directory levels |
|
134 below the command line arguments. If any <codeph>-maxdepth</codeph> primary |
|
135 is specified, it applies to the entire expression even if it would not normally |
|
136 be evaluated. <codeph>-maxdepth</codeph> 0 limits the whole search to the |
|
137 command line arguments. </p> </entry> |
|
138 </row> |
|
139 <row> |
|
140 <entry><p> <codeph>-mindepth n</codeph> </p> </entry> |
|
141 <entry><p>Always true; do not apply any tests or actions at levels less than <codeph>n</codeph>. |
|
142 If any <codeph>-mindepth</codeph> primary is specified, it applies to the |
|
143 entire expression even if it would not normally be evaluated. <codeph>-mindepth</codeph> 1 |
|
144 processes all but the command line arguments. </p> </entry> |
|
145 </row> |
|
146 <row> |
|
147 <entry><p> <codeph>-mtime n</codeph> </p> </entry> |
|
148 <entry><p>If no units are specified, this primary evaluates to true if the |
|
149 difference between the file last modification time and the time <codeph>find</codeph> was |
|
150 started, rounded up to the next full 24-hour period, is <codeph>n</codeph> 24-hour |
|
151 periods. </p> </entry> |
|
152 </row> |
|
153 <row> |
|
154 <entry><p> <codeph>-name pattern</codeph> </p> </entry> |
|
155 <entry><p>True if the last component of the pathname being examined matches <codeph>pattern</codeph>. |
|
156 Special shell pattern matching characters <b>[</b>, <b>]</b>, <b>*</b>, and <b>?</b> may |
|
157 be used as part of <codeph>pattern</codeph>. These characters may be matched |
|
158 explicitly by escaping them with a backslash (<b>\</b>). </p> </entry> |
|
159 </row> |
|
160 <row> |
|
161 <entry><p> <codeph>-newer file</codeph> </p> </entry> |
|
162 <entry><p>True if the current file has a more recent last modification time |
|
163 than <codeph>file</codeph>. </p> </entry> |
|
164 </row> |
|
165 <row> |
|
166 <entry><p> <codeph>-path pattern</codeph> </p> </entry> |
|
167 <entry><p>True if the pathname being examined matches <codeph>pattern</codeph>. |
|
168 Special shell pattern matching characters <b>[</b>, <b>]</b>, <b>*</b>, and <b>?</b> may |
|
169 be used as part of <codeph>pattern</codeph>. These characters may be matched |
|
170 explicitly by escaping them with a backslash (<b>\</b>). Slashes (<b>/</b>) |
|
171 are treated as normal characters and do not have to be matched explicitly. </p> </entry> |
|
172 </row> |
|
173 <row> |
|
174 <entry><p> <codeph>-print</codeph> </p> </entry> |
|
175 <entry><p>This primary always evaluates to true. It prints the pathname of |
|
176 the current file to standard output. If none of <codeph>-exec</codeph>, <codeph>-ls</codeph>, <codeph>-print0</codeph>, |
|
177 or <codeph>-ok</codeph> is specified, the given expression shall be effectively |
|
178 replaced by <codeph>( given expression ) -print</codeph>. </p> </entry> |
|
179 </row> |
|
180 <row> |
|
181 <entry><p> <codeph>-print0</codeph> </p> </entry> |
|
182 <entry><p>This primary always evaluates to true. It prints the pathname of |
|
183 the current file to standard output, followed by an ASCII NUL character (character |
|
184 code 0). </p> </entry> |
|
185 </row> |
|
186 <row> |
|
187 <entry><p> <codeph>-printx</codeph> </p> </entry> |
|
188 <entry><p>This primary always evaluates to true. It prints the pathname of |
|
189 the current file to standard output in a new line. </p> </entry> |
|
190 </row> |
|
191 <row> |
|
192 <entry><p> <codeph>-prune </codeph> </p> </entry> |
|
193 <entry><p>This primary always evaluates to true. It causes <codeph>find</codeph> to |
|
194 not descend into the current file. Note, the <codeph>-prune</codeph> primary |
|
195 has no effect if the <codeph>-d</codeph> option was specified. </p> </entry> |
|
196 </row> |
|
197 <row> |
|
198 <entry><p> <codeph>-size n[c]</codeph> </p> </entry> |
|
199 <entry><p>True if the file's size, rounded up, in 512-byte blocks is <codeph>n</codeph>. |
|
200 If <codeph>n</codeph> is followed by a <codeph>c</codeph>, then the primary |
|
201 is true if the file's size is <codeph>n</codeph> bytes (characters). </p> </entry> |
|
202 </row> |
|
203 <row> |
|
204 <entry><p> <codeph>-type t</codeph> </p> </entry> |
|
205 <entry><p>True if the file is of the specified type. Possible file types are |
|
206 as follows: </p> <ul> |
|
207 <li id="GUID-97C7E16D-608B-51A7-AD08-4C241BAA39CB"><p> <b>b:</b> Block special </p> </li> |
|
208 <li id="GUID-38CB8D36-3029-505E-BC8D-473DD9E11A7A"><p> <b>c:</b> Character |
|
209 special </p> </li> |
|
210 <li id="GUID-F9FC28B8-068E-5477-BA54-A9AC6C1D3EED"><p> <b>d:</b> Directory </p> </li> |
|
211 <li id="GUID-555704A1-D975-59BF-8E66-730206EE2DE9"><p> <b>f:</b> Regular file </p> </li> |
|
212 <li id="GUID-B884FFCD-714A-5F06-BE33-F6230B4E96C8"><p> <b>p:</b> FIFO </p> </li> |
|
213 <li id="GUID-8A00A407-CD09-5958-B2B1-926C6F4660D4"><p> <b>s:</b> Socket </p> </li> |
|
214 </ul> </entry> |
|
215 </row> |
|
216 </tbody> |
|
217 </tgroup> |
|
218 </table> <p>All primaries which take a numeric argument allow the number to |
|
219 be preceded by a plus sign (<b>+</b>) or a minus sign (<b>-</b>). A preceding |
|
220 plus sign means <b>more than n</b>, a preceding minus sign means <b>less than |
|
221 n</b> and neither means <b>exactly n</b>. </p> <p> <b>Note:</b> The following |
|
222 primaries are not supported by the Symbian version of the <codeph>find</codeph> command: </p> <ul> |
|
223 <li id="GUID-805044AB-3DE8-5B8F-98D7-55FB2225EEBD"><p><codeph>-exec exe {} |
|
224 \;</codeph> </p> </li> |
|
225 <li id="GUID-0EDF9DA7-E700-5856-A435-9CE89599F08A"><p><codeph>-fstype</codeph> </p> </li> |
|
226 <li id="GUID-13BE7836-F93B-591F-826B-B601B205F59D"><p><codeph>-group</codeph> </p> </li> |
|
227 <li id="GUID-2E82D489-6421-55C7-8B03-C6B87D4923F1"><p><codeph>-inum</codeph> </p> </li> |
|
228 <li id="GUID-29C2484B-E991-5872-AB04-FAD73815F178"><p><codeph>-iregex</codeph> </p> </li> |
|
229 <li id="GUID-DA21023E-0ED4-5400-9DCD-53FEE6F8E35D"><p><codeph>-nouser</codeph> </p> </li> |
|
230 <li id="GUID-E8A96727-BD43-5FEA-A298-2DD253A15A8D"><p><codeph>-nogroup</codeph> </p> </li> |
|
231 <li id="GUID-1A8880CF-1F34-56B8-8F75-89CB27D9A51A"><p><codeph>-perm,</codeph> </p> </li> |
|
232 <li id="GUID-189A601F-5065-5A0B-85B8-BC55CF34D5B3"><p><codeph>-user</codeph> </p> </li> |
|
233 </ul> </section> |
|
234 <section><title>Operators</title> <p>The primaries may be combined using the |
|
235 following operators. The operators are listed in order of decreasing precedence. </p> <table id="GUID-FB435821-5475-50A3-8DA1-6A8457CFD3ED"> |
|
236 <tgroup cols="2"><colspec colname="col0" colwidth="0.49*"/><colspec colname="col1" colwidth="1.51*"/> |
|
237 <thead> |
|
238 <row> |
|
239 <entry><p><b>Operator</b></p></entry> |
|
240 <entry><p><b>Description</b></p></entry> |
|
241 </row> |
|
242 </thead> |
|
243 <tbody> |
|
244 <row> |
|
245 <entry><p> <codeph>( expression ) </codeph> </p> </entry> |
|
246 <entry><p>This evaluates to true if the parenthesized expression evaluates |
|
247 to true. </p> </entry> |
|
248 </row> |
|
249 <row> |
|
250 <entry><p> <codeph>! expression</codeph> </p> </entry> |
|
251 <entry><p>This is the unary NOT operator. It evaluates to true if the expression |
|
252 is false. </p> </entry> |
|
253 </row> |
|
254 <row> |
|
255 <entry><p> <codeph>expression -and expression</codeph> </p> </entry> |
|
256 <entry><p>The <codeph>-and</codeph> operator is the logical AND operator. |
|
257 As it is implied by the juxtaposition of two expressions it does not have |
|
258 to be specified. The expression evaluates to true if both expressions are |
|
259 true. The second expression is not evaluated if the first expression is false. </p> </entry> |
|
260 </row> |
|
261 <row> |
|
262 <entry><p> <codeph>expression -or expression</codeph> </p> </entry> |
|
263 <entry><p>The <codeph>-or</codeph> operator is the logical OR operator. The |
|
264 expression evaluates to true if either the first or the second expression |
|
265 is true. The second expression is not evaluated if the first expression is |
|
266 true. </p> </entry> |
|
267 </row> |
|
268 </tbody> |
|
269 </tgroup> |
|
270 </table> <p>All operands and primaries must be separate arguments to <codeph>find</codeph>. |
|
271 Primaries which themselves take arguments expect each argument to be a separate |
|
272 argument to <codeph>find</codeph>. </p> </section> |
|
273 <section><title>Copyright notice</title> <p>For information about documentation |
|
274 copyrights associated with the <codeph>find</codeph> command, see <xref href="http://www.freebsd.org/copyright/freebsd-doc-license.html" scope="external">http://www.freebsd.org/copyright/freebsd-doc-license.html</xref>. </p> <p><b>The |
|
275 FreeBSD Documentation License</b> </p> <p>Copyright 1994-2006 The FreeBSD |
|
276 Project. All rights reserved. </p> <p>Redistribution and use in source (SGML |
|
277 DocBook) and 'compiled' forms (SGML, HTML, PDF, PostScript, RTF and so forth) |
|
278 with or without modification, are permitted provided that the following conditions |
|
279 are met: </p> <ol id="GUID-8477E6A8-CC08-5A9D-B03B-AE68C44FD987"> |
|
280 <li id="GUID-BD106442-7374-5E61-BDF8-8DBAB72BED55"><p>Redistributions of source |
|
281 code (SGML DocBook) must retain the above copyright notice, this list of conditions |
|
282 and the following disclaimer as the first lines of this file unmodified. </p> </li> |
|
283 <li id="GUID-F49490B2-7096-5365-9245-33E83CAB1562"><p>Redistributions in compiled |
|
284 form (transformed to other DTDs, converted to PDF, PostScript, RTF and other |
|
285 formats) must reproduce the above copyright notice, this list of conditions |
|
286 and the following disclaimer in the documentation and/or other materials provided |
|
287 with the distribution. </p> </li> |
|
288 </ol> <p>THIS DOCUMENTATION IS PROVIDED BY THE FREEBSD DOCUMENTATION PROJECT |
|
289 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
|
290 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
291 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD DOCUMENTATION PROJECT |
|
292 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
293 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
294 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
295 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
296 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
|
297 USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </p> </section> |
|
298 </conbody></concept> |