Linux Bzip2命令解压缩实现步骤

运维 系统运维
Linux Bzip2压缩命令系列第二讲,这里介绍两组命令gzip, zcat 命令和Linux Bzip2, bzcat 命令,同样会有很多的例子来供我们学习。

前面文章介绍了Linux压缩解压命令的tar命令,相信过举例,大家应该对tar命令的应用相当熟悉了吧,这里继续介绍两组Linux压缩解压命令gzip, zcat 命令和Linux Bzip2, bzcat 命令,还是和前面一样会有详细的例子。

gzip, zcat 命令
[root@linux ~]# gzip [-cdt#] 档名
[root@linux ~]# zcat 档名.gz
◆参数:
-c :将压缩的资料输出到萤幕上,可透过资料流重导向来处理;
-d :解压缩的参数;
-t :可以用来检验一个压缩档的一致性~看看文件有无错误;
-# :压缩等级,-1 最快,但是压缩比最差、-9 最慢,但是压缩比***!预设是 -6 ~
◆范例:
范例一:将 /etc/man.config 複制到 /tmp ,并且以 gzip 压缩
[root@linux ~]# cd /tmp
[root@linux tmp]# cp /etc/man.config .
[root@linux tmp]# gzip man.config
# 此时 man.config 会变成 man.config.gz !
范例二:将范例一的文件内容读出来!
[root@linux tmp]# zcat man.config.gz
# 此时萤幕上会显示 man.config.gz 解压缩之后的文件内容!!

范例三:将范例一的文件解压缩
[root@linux tmp]# gzip -d man.config.gz

范例四:将范例三解开的 man.config 用***的压缩比压缩,并保留原本的文件
[root@linux tmp]# gzip -9 -c man.config > man.config.gz

Linux Bzip2, bzcat 命令
[root@linux ~]# bzip2 [-cdz] 档名
[root@linux ~]# bzcat 档名.bz2
◆参数:
-c :将压缩的过程产生的资料输出到萤幕上!
-d :解压缩的参数
-z :压缩的参数
-# :与 gzip 同样的,都是在计算压缩比的参数, -9 ***, -1 最快!
◆范例:
范例一:将刚刚的 /tmp/man.config 以 bzip2 压缩
[root@linux tmp]# bzip2 -z man.config
# 此时 man.config 会变成 man.config.bz2 !
范例二:将范例一的文件内容读出来!
[root@linux tmp]# bzcat man.config.bz2
# 此时萤幕上会显示 man.config.bz2 解压缩之后的文件内容!!

范例三:将范例一的文件解压缩
[root@linux tmp]# bzip2 -d man.config.bz2

范例四:将范例三解开的 man.config 用***的压缩比压缩,并保留原本的文件
[root@linux tmp]# bzip2 -9 -c man.config > man.config.bz2

【编辑推荐】

  1. 举例说明Linux压缩命令--tar
  2. 总结Linux压缩解压的所有命令
  3. 简单介绍你不知道的ubantu使用技巧
  4. 详细介绍国内Linux十大版本特点(一)
  5. 选择Linux认证之路的理由
责任编辑:chenqingxiang 来源: 互联网
相关推荐

2010-06-24 10:42:42

Bzip2压缩

2010-06-24 10:21:46

Linux Bzip2

2009-10-21 13:04:58

Linux压缩打包方法

2010-03-04 13:33:28

Linux压缩命令

2010-01-04 09:27:31

Linux压缩解压缩命令详解

2023-01-30 09:04:56

Linux命令unzip

2021-02-22 07:58:52

Linux压缩解压

2012-05-10 09:43:28

2010-06-24 10:25:55

Linux Bzip2

2011-08-11 16:41:09

bzip2中文man

2018-09-14 16:18:26

Linux压缩文件应用程序

2010-06-24 10:59:11

Bzip2算法

2011-07-27 16:26:42

iPhone 解压 gzip

2016-11-17 22:02:13

Linux压缩及解压缩

2018-06-01 10:37:26

Linux归档文件压缩文件

2023-12-21 07:30:36

PythonZipfileTarfile

2023-03-29 08:59:59

Go压缩包文档

2010-03-05 09:50:37

Ubuntu ligh

2009-10-21 09:10:52

VB.NET压缩

2009-12-08 16:33:45

PHP unpack函
点赞
收藏

51CTO技术栈公众号