2019-04-21 11:50:48 +08:00

23 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="cat">cat</h1>
<p>连接文件并打印到标准输出设备上</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>cat命令</strong> 连接文件并打印到标准输出设备上cat经常用来显示文件的内容类似于下的type命令。</p>
<p>注意当文件较大时文本在屏幕上迅速闪过滚屏用户往往看不清所显示的内容。因此一般用more等命令分屏显示。为了控制滚屏可以按Ctrl+S键停止滚屏按Ctrl+Q键可以恢复滚屏。按Ctrl+C中断键可以终止该命令的执行并且返回Shell提示符状态。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">cat(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-n或--number从1开始对所有输出的行数编号
-b或--number-nonblank和-n相似只不过对于空白行不编号
-s或--squeeze-blank当遇到有连续两行以上的空白行就代换为一行的空白行
-A显示不可打印字符行尾显示“$”;
-e等价于&quot;-vE&quot;选项;
-t等价于&quot;-vT&quot;选项;</code></pre>
<h3 id="参数">参数</h3>
<p>文件列表:指定要连接的文件列表。</p>
<h3 id="实例">实例</h3>
<p>设m1和m2是当前目录下的两个文件</p>
<pre><code class="language-bash">cat m1 在屏幕上显示文件m1的内容
cat m1 m2 同时显示文件m1和m2的内容
cat m1 m2 &gt; file 将文件m1和m2合并后放入文件file中</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->