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

📄 tail.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>tail</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_2182">&nbsp;</a>NAME</h4><blockquote>tail - copy the last part of a file</blockquote><h4><a name = "tag_001_014_2183">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>tail <b>[</b>-f<b>][</b> -c <i>number</i>| -n <i>number</i><b>] [</b><i>file</i><b>]</b>tail -<b>[</b><i>number</i><b>][</b>b|c|l<b>][</b>f<b>] [</b><i>file</i><b>]</b>tail +<b>[</b><i>number</i><b>][</b>b|c|l<b>][</b>f<b>] [</b><i>file</i><b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_2184">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>tail</i>utility copies its input file to the standard output beginningat a designated place.<p>Copying begins at the point in the file indicated by the<b>-c</b>&nbsp;<i>number</i>or<b>-n</b>&nbsp;<i>number</i>options(or the &plusmn;<i>number</i>portion of the argument to the obsolescent version).The option-argument<i>number</i>is counted in units of lines or bytes,according to the options<b>-n</b>and<b>-c</b>(or, in the obsolescent version, theappended option suffixesl(lines),b(512-byte blocks)orc(bytes)).Both line and byte counts start from 1.<p>Tails relative to the end of the filemay be saved in an internal buffer, and thusmay be limited in length.Such a buffer,if any, will be no smaller than{LINE_MAX}*10bytes.</blockquote><h4><a name = "tag_001_014_2185">&nbsp;</a>OPTIONS</h4><blockquote>The<i>tail</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> ,except that the obsolescent version accepts multi-characteroptions that can preceded by a plus sign.<p>The following options are supported:<dl compact><dt><b>-c&nbsp;</b><i>number</i><dd>The<i>number</i>option-argument must be a decimal integer whose signaffects the location in the file,measured in bytes, to begin the copying:<pre><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Sign</b><th align=center><b>Copying Starts</b><tr valign=top><td align=center><b>+</b><td align=left>Relative to the beginning of the file.<tr valign=top><td align=center><b>-</b><td align=left>Relative to the end of the file.<tr valign=top><td align=center><b><i>none</i></b><td align=left>Relative to the end of the file.</table></pre>The origin for counting is 1;that is,<b>-c +1</b>represents the first byte of the file,<b>-c -1</b>the last.<dt><b>-f</b><dd>If the input file is a regular file or if the<i>file</i>operand specifies a FIFO,do not terminate after the last line of the inputfile has been copied, but read and copyfurther bytes from the input file when they become available.If no<i>file</i>operand is specifiedand standard input is a pipe, the<b>-f</b>option will be ignored.If the input file is not a FIFO, pipe or regular file, it isunspecified whether or not the<b>-f</b>option will be ignored.<dt><b>-n&nbsp;</b><i>number</i><dd>This option is equivalent to<b>-c</b>&nbsp;<i>number</i>,except the starting location inthe file is measured in lines instead of bytes.The origin for counting is 1;that is,<b>-n +1</b>represents the first line of the file,<b>-n -1</b>the last.</dl><p>In the non-obsolescent form, if neither<b>-c</b>nor<b>-n</b>is specified,<b>-n 10</b>is assumed.<p>In the obsolescent version, an argument beginning with a "-" or "+"can be used as a single option.The argument<i>&plusmn;number</i>with the lettercspecified as a suffix is equivalent to<b>-c</b>&nbsp;<i>&plusmn;number</i>;<i>&plusmn;number</i>with thebsuffix is equivalent to<b>-c</b>&nbsp;<i>&plusmn;number</i>*512;<i>&plusmn;number</i>with the letterlspecified as a suffix, or with none ofb,cnorlas a suffix, is equivalent to<b>-n</b>&nbsp;<i>&plusmn;number</i>.If<i>number</i>is not specified in these forms, 10 will be used.The letterfspecified as a suffix is equivalent to specifying the<b>-f</b>option.If the<b>-[</b><i>number</i><b>]c[f]</b>form is used and neither<i>number</i>nor thefsuffix is specified, it will be interpreted as the<b>-c&nbsp;10</b>option.</blockquote><h4><a name = "tag_001_014_2186">&nbsp;</a>OPERANDS</h4><blockquote>The following operand is supported:<dl compact><dt><i>file</i><dd>A pathname of an input file.If no<i>file</i>operands are specified,the standard input will be used.</dl></blockquote><h4><a name = "tag_001_014_2187">&nbsp;</a>STDIN</h4><blockquote>The standard input will be used only if no<i>file</i>operands are specified.See the INPUT FILES section.</blockquote><h4><a name = "tag_001_014_2188">&nbsp;</a>INPUT FILES</h4><blockquote>If the<b>-c</b>option is specified, the input file can contain arbitrarydata; otherwise, the input file must be a text file.</blockquote><h4><a name = "tag_001_014_2189">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>tail</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments and input files).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_2190">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_2191">&nbsp;</a>STDOUT</h4><blockquote>The designated portion of the input file will be written to standard output.</blockquote><h4><a name = "tag_001_014_2192">&nbsp;</a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_2193">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_2194">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_2195">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>Successful completion.<dt>&gt;0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_2196">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_2197">&nbsp;</a>APPLICATION USAGE</h4><blockquote>The<b>-c</b>option should be used with caution when theinput is a text file containing multi-byte characters; it mayproduce output that does not start on a character boundary.<p>Although the input file to<i>tail</i>can be any type, the resultsmight not be what would be expected on some character specialdevice files or on file types not described by the <b>XSH</b> specification.Since this specification does not specify the block size used when doing input,<i>tail</i>need not read all of the data from devices thatonly perform block transfers.<p>Thebsuffix in the obsolescent version is not portable outside ofXSI-conformant systems.</blockquote><h4><a name = "tag_001_014_2198">&nbsp;</a>EXAMPLES</h4><blockquote>The<b>-f</b>option can be used to monitor the growth of a file that isbeing written by some other process.For example, the command:<p><pre><code>tail -f fred</code></pre>prints the last ten lines of the file<b>fred</b>,followed by any lines that are appended to<b>fred</b>between the time<b>tail</b>is initiated and killed.As another example, the command:<pre><code>tail -f -c 15 fred</code></pre>prints the last 15 bytes of the file<b>fred</b>,followed by any bytes that are appended to<b>fred</b>between the time<b>tail</b>is initiated and killed.</blockquote><h4><a name = "tag_001_014_2199">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_2200">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="head.html">head</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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