📄 cat.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>cat</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_000_267"> </a>NAME</h4><blockquote>cat - concatenate and print files</blockquote><h4><a name = "tag_000_000_268"> </a>SYNOPSIS</h4><blockquote><pre><code>cat <b>[</b>-u<b>][</b><i>file</i> ...<b>]</b></code></pre></blockquote><h4><a name = "tag_000_000_269"> </a>DESCRIPTION</h4><blockquote>The<i>cat</i>utility reads files in sequenceand writes their contents to the standard outputin the same sequence.</blockquote><h4><a name = "tag_000_000_270"> </a>OPTIONS</h4><blockquote>The<i>cat</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .<p>The following option is supported:<dl compact><dt><b>-u</b><dd>Write bytes from the input file to the standard outputwithout delay as each is read.</dl></blockquote><h4><a name = "tag_000_000_271"> </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 is used.If a<i>file</i>is "-", the<i>cat</i>utility will read from the standard input at that point in the sequence.The<i>cat</i>utility will not close and reopen standard input whenit is referenced in this way, but will accept multiple occurrences of"-" as a<i>file</i>operand.</dl></blockquote><h4><a name = "tag_000_000_272"> </a>STDIN</h4><blockquote>The standard input is used only if no<i>file</i>operands are specified, or if a<i>file</i>operand is "-".See the INPUT FILES section.</blockquote><h4><a name = "tag_000_000_273"> </a>INPUT FILES</h4><blockquote>The input files can be any file type.</blockquote><h4><a name = "tag_000_000_274"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>cat</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).<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_000_000_275"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_000_000_276"> </a>STDOUT</h4><blockquote>The standard output will contain the sequence of bytes read fromthe input files.Nothing else will be written to the standard output.</blockquote><h4><a name = "tag_000_000_277"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_000_000_278"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_279"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_280"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>All input files were output successfully.<dt>>0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_000_000_281"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_000_000_282"> </a>APPLICATION USAGE</h4><blockquote>The<b>-u</b>option has value inprototyping non-blocking reads from FIFOs.The intent is to support the following sequence:<pre><code>mkfifo foocat -u foo > /dev/tty13 &cat -u > foo</code></pre><p>It is unspecified whether standard outputis or is not buffered in thedefault case.This is sometimes of interest when standard output is associatedwith a terminal, since buffering may delay the output.The presence of the<b>-u</b>option guarantees that unbufferedI/Ois available.It is implementation-dependent whether the<i>cat</i>utility buffers output if the<b>-u</b>option is not specified.Traditionally, the<b>-u</b>option is implemented using theequivalent of the <b>XSH</b> specification<i><a href="../xsh/setvbuf.html">setvbuf()</a></i>function.</blockquote><h4><a name = "tag_000_000_283"> </a>EXAMPLES</h4><blockquote>The following command:<pre><code>cat myfile</code></pre>writes the contents of the file<b>myfile</b>to standard output.<p>The following command:<pre><code>cat doc1 doc2 > doc.all</code></pre>concatenates the files<b>doc1</b>and<b>doc2</b>and writes the result to<b>doc.all</b>.<p>Because of the shell language mechanism used toperform output redirection, acommand such as this:<pre><code>cat doc doc.end > doc</code></pre>causes the original data in<b>doc</b>to be lost.<p>The command:<pre><code>cat start - middle - end > file</code></pre>when standard input is a terminal, gets two arbitrary pieces ofinput from the terminal with a single invocation of<i>cat</i>.Note, however, that if standard input is a regular file, this would beequivalent to the command:<pre><code>cat start - middle /dev/null end > file</code></pre>because the entire contents of the file would be consumed by<i>cat</i>the first time "-" was used as a<i>file</i>operand and an end-of-filecondition would be detected immediately when "-" was referencedthe second time.</blockquote><h4><a name = "tag_000_000_284"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_285"> </a>SEE ALSO</h4><blockquote><i><a href="more.html">more</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 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 + -