压缩打包介绍 gip压缩工具 bzip压缩工具 xz压缩工具

1.linux下常见的后缀名所对应的压缩工具。

.gz:表示由gzip压缩工具压缩的文件。

.bz:表示由bzip2压缩工具压缩的文件。

.tar:表示由tar打包程序打包的文件。

.tar.gz:先由tar打包,再由gzip压缩。

.tar.bz2:先由tar打包,再由bgzip压缩。

.tar.bz2:先由tar打包,再由xz压缩。

2.gip压缩工具

gizp命令格式为gizap [-d#] filename 其中#为1-9的数字。

-d:解压缩时使用。

-#:表示压缩等级,1为最差,9为最好,6为默认。

[root@bogon ~]# mkdir /tmp/8
[root@bogon ~]# cd /tmp/8
[root@bogon 8]# mkdir test
[root@bogon 8]# mv /tmp/1.txt test
[root@bogon 8]# cd test
[root@bogon test]# ls
1.txt
[root@bogon test]# gzip 1.txt
[root@bogon test]# ls
1.txt.gz

gzip后面跟文件名,表示在当前目录下压缩该文件,而元文件也会消失。

解压缩命令:

[root@bogon test]# gzip -d 1.txt.gz
[root@bogon test]# ls
1.txt

gzip -d后面跟压缩文件表示解压缩该文件。gzip不支持压缩目录。

[root@bogon test]# cd ..
[root@bogon 8]# gzip test
gzip: test is a directory -- ignored
[root@bogon 8]# ls test
1.txt

3.bzip2压缩工具

bzip2命令格式为bzip2 [-dz] filename 只有-z(压缩)和-d(解压缩)两个选项。默认级别是9。压缩是加或不加-z选项都可以压缩文件。bzip不支持压缩目录。

[root@bogon test]# bzip2 -d 1.txt.bz2
[root@bogon test]# bzip2 -z 1.txt
[root@bogon test]# ls
1.txt.bz2

4.下这压缩工具

xz命令的格式为xz [-dz] filename ,只有-z和-d两个选项。压缩是加或不加-z选项都可以压缩文件。

xz命令

[root@bogon test]# bzip2 -d 1.txt.bz2
[root@bogon test]# xz 1.txt
[root@bogon test]# ls
1.txt.xz
[root@bogon test]# xz -d 1.txt.xz
[root@bogon test]# xz -z 1.txt
[root@bogon test]# ls
1.txt.xz

 

转载于:https://my.oschina.net/u/3866192/blog/1834189

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值