(8)——文件查找与文件管理2
最后更新于:2022-04-01 14:44:25
## 四、压缩
gzip, gunzip
Linux标准压缩工具
对文本文件可以达到75%的压缩率
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb1d2657.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb1e494f.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb201d9a.jpg)
compress, uncompress
旧的Unix压缩工具
bzip2, bunzip2
更新的Linux压缩工具
比gzip有着更高的压缩率
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb214d35.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb22661c.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb237449.jpg)
## 五、打包(tar)
用于在磁带机、软盘、ZIP设备上做备份。也可以备份在一个硬盘文件上。(并不提供压缩功能)
主要参数:
c :将文件备份出来
v :将过程输出
f :打包后改变文件名
t :列出tar包中的内容
x :从一个文件中解出备份
z :使用gzip工具压缩
j :使用bz2工具进行压缩
C :改变打包后文件路径
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb24931c.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb25cd29.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb25cd29.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb274cbe.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb29e9f6.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb2b194b.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb2c5da9.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-06-14_575f8bb2d8eb5.jpg)
## 六、备份与还原文件系统(dump / restore)
备份与还原ext2/3文件系统
不可以在其他文件系统上使用
可以选择进行完全备份或增量备份
dump -0u -f /var/tmp/hda2dump /dev/hda1 :将/dev/hda1备份到 /var/tmp/hda2dump文件中
0 :代表完全备份
u :将备份记录写入 /etc/dumpdates (备份分区顶层目录才可以使用该参数)
f :指定备份到文件的路径
restore -rf /var/tmp/hda2dump :将备份文件还原
r :还原备份文件
t :列出备份文件里面的内容
f :指定备份文件