6.1 壓縮打包介紹linux
6.2 gzip壓縮工具工具
6.3 bzip2壓縮工具 spa
6.4 xz壓縮工具 ip
6.1 壓縮打包介紹打包
gzip壓縮工具命名
gzip 1.txtgzip
gzip -d 1.txt.gz /gunzip 1.txt.gz文件
gzip -# 1.txt //#範圍1-9 ,默認6co
不能壓縮目錄new
zcat 1.txt.gz
gzip -c 1.txt >/root/1.txt.gz
gunzip -c /root/1.txt.gz > /tmp/1.txt.new
#gzip壓縮解壓縮運用
[root@zgxlinux-01 tmp]# find /etc/ -type f -name "*conf" -exec cat {} >> /tmp/d6z/1.txt \; #查找etc下以conf結尾的文件而且追加到/d6z/1.txt中。 [root@zgxlinux-01 tmp]# du /tmp/d6z/1.txt 236 /tmp/d6z/1.txt [root@zgxlinux-01 d6z]# gzip 1.txt #壓縮文件1.txt [root@zgxlinux-01 d6z]# ls 1.txt.gz [root@zgxlinux-01 d6z]# du -sh 1.txt.gz 64K 1.txt.gz [root@zgxlinux-01 d6z]# gzip -d 1.txt.gz #加壓縮-d [root@zgxlinux-01 d6z]# ls 1.txt [root@zgxlinux-01 d6z]# gzip -c 1.txt > /tmp/zgx/1.txt.gz #壓縮文件到其餘目錄而且保留源文件 [root@zgxlinux-01 d6z]# ls 1.txt [root@zgxlinux-01 d6z]# ls /tmp/zgx/ 111 1.txt.gz [root@zgxlinux-01 d6z]# gunzip -c /tmp/zgx/1.txt.gz > /tmp/d6z/2.txt #解壓縮打包文件後重命名且保留源文件 [root@zgxlinux-01 d6z]# ls 1.txt 2.txt
xz壓縮工具
xz 1.txt /xz -z 1.txt
xz -d 1.txt.xz /unxz 1.txt.xz
xz -# 1.txt //#範圍1-9 ,默認6
不能壓縮目錄
xzcat 1.txt.xz
xz -c 1.txt > /root/1.txt.xz
xz -d -c /root/1.txt.xz >1.txt.new3
bzip2 壓縮工具 #用法和gzip用法基本相同,但壓縮比例比gzip更高。
bzip2 .1txt /bzip2 -z 1.txt
bzip2 -d 1.txt.bz2 /bunzip2 1.txt.bz2
bzip -# 1.txt //#範圍1-9,默認9
不能壓縮目錄
bzcat 1.txt.bz2
bzip2 -c 1.txt > /root/1.txt.bz2
bzip2 -c -d /root/1.txt.bz2 >/tmp/1.txt.new2
[root@zgxlinux-01 d6z]# bzip2 1.txt [root@zgxlinux-01 d6z]# ls 1.txt.bz2 2.txt [root@zgxlinux-01 d6z]# du -sh 1.txt.bz2 56K 1.txt.bz2 [root@zgxlinux-01 d6z]# bzip2 -d 1.txt.bz2 [root@zgxlinux-01 d6z]# ls 1.txt 2.txt [root@zgxlinux-01 d6z]# bzip2 1.txt [root@zgxlinux-01 d6z]# bunzip2 1.txt.bz2 [root@zgxlinux-01 d6z]# ls 1.txt 2.txt
tar打包工具
tar -cvf 123.tar 123
tar -cvf aming.tar 1.txt 123
tar -xvf aming.tar
tar -tf aming.tar
tar -cvf aming.tar --exclude 1.txt --exclude 2 123