1 | compress
|
2 | ===
|
3 |
|
4 | 使用Lempress-Ziv编码压缩数据文件
|
5 |
|
6 | ## 补充说明
|
7 |
|
8 | **compress命令** 使用“Lempress-Ziv”编码压缩数据文件。compress是个历史悠久的压缩程序,文件经它压缩后,其名称后面会多出".Z"的扩展名。当要解压缩时,可执行uncompress指令。事实上uncompress是指向compress的符号连接,因此不论是压缩或解压缩,都可通过compress指令单独完成。
|
9 |
|
10 | ### 语法
|
11 |
|
12 | ```shell
|
13 | compress(选项)(参数)
|
14 | ```
|
15 |
|
16 | ### 选项
|
17 |
|
18 | ```shell
|
19 | -f:不提示用户,强制覆盖掉目标文件;
|
20 | -c:将结果送到标准输出,无文件被改变;
|
21 | -r:递归的操作方式;
|
22 | -b<压缩效率>:压缩效率是一个介于9~16的数值,预设值为"16",指定愈大的数值,压缩效率就愈高;
|
23 | -d:对文件进行解压缩而非压缩;
|
24 | -v:显示指令执行过程;
|
25 | -V:显示指令版本及程序预设值。
|
26 | ```
|
27 |
|
28 | ### 参数
|
29 |
|
30 | 文件:指定要压缩的文件列表。
|
31 |
|
32 | ### 实例
|
33 |
|
34 | 将`/etc/man.config`复到`/tmp` ,并加以压缩
|
35 |
|
36 | ```shell
|
37 | [root@localhost ~]# cd /tmp
|
38 | [root@localhost tmp]# cp /etc/man.config .
|
39 | [root@localhost tmp]# compress man.config
|
40 | [root@localhost tmp]# ls -l
|
41 | ```
|
42 |
|
43 | ```shell
|
44 | -rw-r--r-- 1 root root 2605 Jul 27 11:43 man.config.Z
|
45 | ```
|
46 |
|
47 | 将刚刚的压缩档解开
|
48 |
|
49 | ```shell
|
50 | [root@localhost tmp]# compress -d man.config.Z
|
51 | ```
|
52 |
|
53 | 将 man.config 压缩成另外一个文件来备份
|
54 |
|
55 | ```shell
|
56 | [root@localhost tmp]# compress -c man.config > man.config.back.Z
|
57 | [root@localhost tmp]# ll man.config*
|
58 | ```
|
59 |
|
60 | ```shell
|
61 | -rw-r--r-- 1 root root 4506 Jul 27 11:43 man.config
|
62 | -rw-r--r-- 1 root root 2605 Jul 27 11:46 man.config.back.Z
|
63 | ```
|
64 |
|
65 | 这个`-c`的选项比较有趣!会将压缩过程的资料输出到屏幕上,而不是写入成为file.Z文件。所以,我们可以透过资料流重导向的方法将资料输出成为另一个档名。
|
66 |
|
67 |
|
68 |
|
\ | No newline at end of file |