压缩打包
[root@localhost ~]# dd if=/dev/zero of-/tmp/data bs=10M count=20
/dev/zero 零发生器
bs block size 块大小
count 数量
压缩
gzip
[root@localhost ~]# gzip data 压缩
[root@localhost ~]# gunzip data.gz 解压缩
bzip2
[root@localhost ~]# bzip2 data 压缩
[root@localhost ~]# bunzip dada.bz2 解压缩
打包
[root@localhost ~]# tar -cvf /tmp/boot.tar /boot
-c 创建
-v 显示过程
-f file
[root@localhost ~]# du -sh /boot/ 查看目录的最大容量
-s 总量
-h 按最大单位显示
[root@localhost ~]# tar -tvf /tmp/boot.tar
-t 查看内容
[root@localhost ~]# tar -rvf /tmp/boot.tar /root/anaconda-ks.cfg
-r 追加打包
[root@localhost ~]# tar -xvf /tmp/boot.tar
-x 解包
[root@localhost ~]# tar -xvf /tmp/boot.tar -C/home
-C指定目录解包
打压缩包
[root@localhost ~]# tar -zcvf /tmp/boot.tar.gz /boot
-z调用gzip
[root@localhost ~]# tar -ztvf /tmp/boot.tar.gz /boot 查看压缩包
[root@localhost ~]# tar -zxvf /tmp/boot.tar.gz -C /tmp/ 解压缩包
[root@localhost ~]# tar -jcvf /tmp/boot.tar.bz2 /boot
-j 调用bzip2
[root@localhost ~]# tar -jtvf /tmp /boot.tar.bz2
[root@localhost ~]# tar -jxvf /tmp /boot.tar.bz2 -C /tmp/