⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 find.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>find</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_738">&nbsp;</a>NAME</h4><blockquote>find - find files</blockquote><h4><a name = "tag_001_014_739">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>find <i>path</i>... <b>[</b><i>operand_expression</i><b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_740">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>find</i>utility will recursively descend the directory hierarchy fromeach file specified by<i>path</i>,evaluating a Boolean expression composed of the primaries described inthe OPERANDS section for each file encountered.<p>The<i>find</i>utility will be able to descend to arbitrary depthsin a file hierarchy and will not fail due to path lengthlimitations (unless a<i>path</i>operand specified by the application exceeds{PATH_MAX}requirements).</blockquote><h4><a name = "tag_001_014_741">&nbsp;</a>OPTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_742">&nbsp;</a>OPERANDS</h4><blockquote>The following operands are supported:<p>The<i>path</i>operand is a pathname of a starting point in the directory hierarchy.<p>The first argument that starts with a "-", or is a "!" or a "(",and all subsequent arguments will be interpreted as an<i>expression</i>made up of the following primaries and operators.In the descriptions, wherever<i>n</i>is used as a primary argument, it will be interpreted as adecimal integer optionally preceded by a plus(+)or minus(-)sign, as follows:<dl compact><dt><b>+</b><i>n</i><dd>more than<i>n</i><dt><i>n</i><dd>exactly<i>n</i><dt><b>-</b><i>n</i><dd>less than<i>n</i>.</dl><p>The following primaries are supported:<dl compact><dt><b>-name&nbsp;</b><i>pattern</i><dd>The primary will evaluate as trueif the basename of thefilename being examined matches<i>pattern</i>using the pattern matching notation described in<a href="chap2.html#tag_001_013">Pattern Matching Notation</a><dt><b>-nouser</b><dd>The primary will evaluate as trueif the file belongs to a user ID for which the <b>XSH</b> specification<i><a href="../xsh/getpwuid.html">getpwuid()</a></i>(or equivalent) function returns NULL.<dt><b>-nogroup</b><dd>The primary will evaluate as trueif the file belongs to a group ID for which the <b>XSH</b> specification<i><a href="../xsh/getgrgid.html">getgrgid()</a></i>(or equivalent) function returns NULL.<dt><b>-xdev</b><dd>The primary always will evaluate as true; it will cause<i>find</i>not to continue descending past directories that have a differentdevice ID(<i>st_dev</i>,see the <b>XSH</b> specification<i><a href="../xsh/stat.html">stat()</a></i>function).If any<b>-xdev</b>primary is specified, it will apply to the entireexpression even if the<b>-xdev</b>primary would not normally be evaluated.<dt><b>-prune</b><dd>The primary always will evaluate as true; it will cause<i>find</i>not to descend the current pathname if it is a directory.If the<b>-depth</b>primary is specified, the<b>-prune</b>primary will have no effect.<dt><b>-perm&nbsp;[-]</b><i>mode</i><dd>The<i>mode</i>argument is used to represent file mode bits.It will be identical in format to the<i>symbolic_mode</i>operand described in<a href="chmod.html#tag_001_014">Special Built-in Utilities</a>and will be interpreted as follows.To start, a template will be assumed with all file mode bits cleared.An<i>op</i>symbol of "+" will set the appropriate mode bits in the template;"-" will clear the appropriate bits; "="will set the appropriate mode bits, without regardto the contents of process' file mode creation mask.The<i>op</i>symbol of "-" cannot be the first character of<i>mode</i>;this avoids ambiguity with the optional leading hyphen.Since the initial mode is all bits off, there are not anysymbolic modes that need to use "-" as the first character.If the hyphen is omitted, the primary will evaluate astrue when the file permission bits exactly matchthe value of the resulting template.Otherwise, if<i>mode</i>is prefixed by a hyphen, the primary will evaluate as trueif at least all the bits in the resulting template are setin the file permission bits.<dt><b>-perm&nbsp;[-]</b><i>onum</i><dd>If the hyphen is omitted, the primary will evaluate astrue when the file permission bits exactly matchthe value of the octal number<i>onum</i>and only the bits corresponding to the octal mask07777 will be compared.(See the description of the octal<i>mode</i>in<i><a href="chmod.html">chmod</a></i>.)Otherwise, if<i>onum</i>is prefixed by a hyphen,the primary will evaluate as trueif at least all of the bits specified in<i>onum</i>that are also set in the octal mask 07777 are set.<dt><b>-type&nbsp;</b><i>c</i><dd>The primary will evaluate as trueif the type of the file is<i>c</i>,where<i>c</i>isb,c,d,porffor block special file, character special file,directory, FIFO or regular file, respectively.<dt><b>-links&nbsp;</b><i>n</i><dd>The primary will evaluate as trueif the file has<i>n</i>links.<dt><b>-user&nbsp;</b><i>uname</i><dd>The primary will evaluate as trueif the file belongs to the user<i>uname.</i>If<i>uname</i>is a decimal integerand the<i><a href="../xsh/getpwnam.html">getpwnam()</a></i>(or equivalent) function does not returna valid user name,<i>uname</i>will be interpreted as a user ID.<dt><b>-group&nbsp;</b><i>gname</i><dd>The primary will evaluate as trueif the file belongs to the group<i>gname</i>.If<i>gname</i>is a decimal integer and the<i><a href="../xsh/getgrnam.html">getgrnam()</a></i>(or equivalent) function does not returna valid group name,<i>gname</i>will be interpreted as a group ID.<dt><b>-size&nbsp;</b><i>n</i><b>[c]</b><dd>The primary will evaluate as trueif the file size in bytes,divided by512 and rounded up to the next integer, is<i>n</i>.If<i>n</i>is followed by the characterc,the size will be in bytes.<dt><b>-atime&nbsp;</b><i>n</i><dd>The primary will evaluate as trueif the file access time subtracted from theinitialisation time is<i>n</i>-1to<i>n</i>multiples of 24 hours.The initialisation time will be a time between the invocation of the<i>find</i>utility and the first access by that invocation of the<i>find</i>utility to any file specified by its<i>path</i>operands.For example,<b>-atime</b>3is true if the file was accessed any time in the periodfrom 72 to 48 hours ago.<dt><b>-mtime&nbsp;</b><i>n</i><dd>The primary will evaluate as trueif the file modification time subtracted from theinitialisation time is<i>n</i>-1to<i>n</i>multiples of 24 hours.The initialisation time will be a time between the invocation of the<i>find</i>utility and the first access by that invocation of the<i>find</i>utility to any file specified by its<i>path</i>operands.<dt><b>-ctime&nbsp;</b><i>n</i><dd>The primary will evaluate as trueif the time of last change of file status informationsubtracted from theinitialisation time is<i>n</i>-1to<i>n</i>multiples of 24 hours.The initialisation time will be a time between the invocation of the<i>find</i>utility and the first access by that invocation of the<i>find</i>utility to any file specified by its<i>path</i>operands.<dt><b>-exec </b><i>utility_name </i><b>[</b><i>argument&nbsp;...</i><b>]&nbsp;;</b><dd>The primary will evaluate as trueif the invoked utility<i>utility_name</i>returns a zero value as exit status.The end of the primary expressionwill be punctuated by a semicolon.A<i>utility_name</i>or<i>argument</i>containing only the two characters{}will be replaced by the current pathname.If a<i>utility_name</i>or argument string contains the two characters{},but not just the two characters{},it is implementation-dependentwhether<i>find</i>replaces those two characters with thecurrent pathname or uses the string without change.The current directory for the invocation of<i>utility_name</i>will be the same as the current directory when the<i>find</i>utility was started.If the<i>utility_name</i>names any of the special built-in utilities in<a href="chap2.html#tag_001_014">Special Built-in Utilities</a>,the results are undefined.<dt><b>-ok&nbsp;</b><i>utility_name&nbsp;</i><b>[</b><i>argument&nbsp;...</i><b>]&nbsp;;</b><dd>The<b>-ok</b>primary will be equivalent to<b>-exec</b>,except that<i>find</i>will request affirmation of the invocation of<i>utility_name</i>using the current file as an argument

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -