zip
压缩前:
压缩后:
下面的做法会导致报错:
提前删除就不会报错:
gzip格式:
bunzip格式:
解包:
xz格式:
上面的各种压缩中,从上到下等待时间依次增加,压缩以后的体积依次变小
打包压缩一步完成:
[root@bogon Desktop]# tar jcf etc.tar.bz2 /etc
tar: Removing leading `/' from member names
[root@bogon Desktop]# tar Jcf etc.tar.xz /etc
tar: Removing leading `/' from member names
[root@bogon Desktop]# tar zcf etc.tar.gz /etc
tar: Removing leading `/' from member names
[root@bogon Desktop]# ls
etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
[root@bogon Desktop]# file *
etc.tar: POSIX tar archive (GNU)
etc.tar.bz2: bzip2 compressed data, block size = 900k
etc.tar.gz: gzip compressed data, last modified: Thu Jan 13 14:07:25 2022, from Unix, original size 28825600
etc.tar.xz: XZ compressed data
[root@bogon Desktop]# ls
etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
[root@bogon Desktop]# tar jxf etc.tar.bz2
[root@bogon Desktop]# ls
etc etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
[root@bogon Desktop]# rm -fr etc
[root@bogon Desktop]# tar zxf etc.tar.gz
[root@bogon Desktop]# ls
etc etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
[root@bogon Desktop]# rm -fr etc
[root@bogon Desktop]# tar Jxf etc.tar.xz
[root@bogon Desktop]# ls
etc etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
[root@bogon Desktop]# rm -fr etc
[root@bogon Desktop]# ls
etc.tar etc.tar.bz2 etc.tar.gz etc.tar.xz
总结:
四个压缩方式
zip | bunzip |
gzip | xz |