压缩工具
Linux中是先打包在压缩文件
? compress ,uncompress传统的最古老的 传统的最古老的Unix压缩工具
? gzip ,gunzip 最广泛的压缩工具
Linux系统中标准压缩工具对于文本文件能够达到很高压缩率,对于文本文件能够达到很高压缩率
? bzip2 ,bunzip2新版Linux压缩工具,比gzip拥有更高的压缩率
#compress source.dat 压缩
# compress -d source.dat.Z 解压
#gzip a 压缩
#gunzip a.gz 两个方法一样 #gzip –d a.gz 解压
#bzip2 a 压缩
#bunzip2 a.bz2 两个方法一样 #bzip2–d a.bz2 解压
2、tar包的使用
? 磁带机、软盘、ZIP设备上做备份。
? 可以备份在硬盘文件上
? 主要参数:
– c:将文件备份出来 创建
– v:将过程输出
– x:从一个文件中解出备份
– r: 将文件添加入已经存在的文件中
? 范例
– 备份:tar cvfbackup.tar *.txt
– 解开:tar xvfbackup.tar –C backup/
#tar cvf /tmp/root.tar /tmp 打包文件/tmp打包到/tmp/roor.tar
#tar rvf /tmp/root.tar /etc/passwd /etc/hosts追加,把passwd/hosts文件追加到打包文件root.tar中,后面可以添加多个文件
#tar xvf /tmp/root.tar -C /tmp/ddd 解压,把root.tar解压到ddd目录下
tvf 查看压缩包
#tar cvfz /tmp/root.tar.gz /tmp/hosts 打包并压缩成.gz文件,解压是xvfz
#tar cvfj /tmp/root.tar.bz2 /tmp/hosts 压缩成bz2压缩文件,压缩程度变高,解压是xvfj