uTools-Manuals/docs/linux/compress.html
2019-04-21 11:50:48 +08:00

33 lines
2.3 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="compress">compress</h1>
<p>使用Lempress-Ziv编码压缩数据文件</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>compress命令</strong> 使用“Lempress-Ziv”编码压缩数据文件。compress是个历史悠久的压缩程序文件经它压缩后其名称后面会多出“.Z”的扩展名。当要解压缩时可执行uncompress指令。事实上uncompress是指向compress的符号连接因此不论是压缩或解压缩都可通过compress指令单独完成。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">compress(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-f不提示用户强制覆盖掉目标文件
-c将结果送到标准输出无文件被改变
-r递归的操作方式
-b&lt;压缩效率&gt;压缩效率是一个介于9~16的数值预设值为&quot;16&quot;,指定愈大的数值,压缩效率就愈高;
-d对文件进行解压缩而非压缩
-v显示指令执行过程
-V显示指令版本及程序预设值。</code></pre>
<h3 id="参数">参数</h3>
<p>文件:指定要压缩的文件列表。</p>
<h3 id="实例">实例</h3>
<p><code>/etc/man.config</code>复到<code>/tmp</code> ,并加以压缩</p>
<pre><code class="language-bash">[root@localhost ~]# cd /tmp
[root@localhost tmp]# cp /etc/man.config .
[root@localhost tmp]# compress man.config
[root@localhost tmp]# ls -l</code></pre>
<pre><code class="language-bash">-rw-r--r-- 1 root root 2605 Jul 27 11:43 man.config.Z</code></pre>
<p>将刚刚的压缩档解开</p>
<pre><code class="language-bash">[root@localhost tmp]# compress -d man.config.Z</code></pre>
<p>将 man.config 压缩成另外一个文件来备份</p>
<pre><code class="language-bash">[root@localhost tmp]# compress -c man.config &gt; man.config.back.Z
[root@localhost tmp]# ll man.config*</code></pre>
<pre><code class="language-bash">-rw-r--r-- 1 root root 4506 Jul 27 11:43 man.config
-rw-r--r-- 1 root root 2605 Jul 27 11:46 man.config.back.Z</code></pre>
<p>这个<code>-c</code>的选项比较有趣会将压缩过程的资料输出到屏幕上而不是写入成为file.Z文件。所以我们可以透过资料流重导向的方法将资料输出成为另一个档名。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->