linux 中 bzip2压缩与解压缩

 

001、测试文件

[root@pc1 test]# ls
a.txt
[root@pc1 test]# ll -h                            ## 测试文件
total 113M
-rw-r--r--. 1 root root 113M Jan  9 12:03 a.txt

 

002、压缩文件(不保留源文件)

[root@pc1 test]# ls
a.txt
[root@pc1 test]# bzip2 a.txt             ## 压缩文件,不保留源文件
[root@pc1 test]# ll -h
total 5.2M
-rw-r--r--. 1 root root 5.2M Jan  9 12:03 a.txt.bz2

 

002、压缩文件(保留源文件)

复制代码
[root@pc1 test]# ls
a.txt
[root@pc1 test]# bzip2 -k a.txt                ## 压缩文件,并保留源文件
[root@pc1 test]# ls
a.txt  a.txt.bz2
[root@pc1 test]# ll -h
total 118M
-rw-r--r--. 1 root root 113M Jan  9 12:03 a.txt
-rw-r--r--. 1 root root 5.2M Jan  9 12:03 a.txt.bz2
复制代码

 。

 

003、解压bz2文件(不保留源文件)

[root@pc1 test]# ls
a.txt.bz2
[root@pc1 test]# bunzip2 a.txt.bz2       ## 解压bz2文件(不保留源文件)
[root@pc1 test]# ls
a.txt
[root@pc1 test]# ll -h
total 113M
-rw-r--r--. 1 root root 113M Jan  9 12:03 a.txt

 

 

004、解压bz2文件(保留源文件)

复制代码
[root@pc1 test]# ls
a.txt.bz2
[root@pc1 test]# bunzip2 -k a.txt.bz2          ## 解压bz2文件,并保留源文件
[root@pc1 test]# ls
a.txt  a.txt.bz2
[root@pc1 test]# ll -h
total 118M
-rw-r--r--. 1 root root 113M Jan  9 12:03 a.txt
-rw-r--r--. 1 root root 5.2M Jan  9 12:03 a.txt.bz2
复制代码

 。

 

posted @   小鲨鱼2018  阅读(81)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2022-01-08 linux中实现将连续的多列数据合并为指定列数据
2022-01-08 linux中将指定行数据合并为一行数据
2021-01-08 c语言中对数组元素进行倒序排列
2021-01-08 c语言中利用键盘输入数组元素的值
2021-01-08 c语言中数组的复制
2021-01-08 C语言中生成数组
2021-01-08 c语言中循环语句汇总
点击右上角即可分享
微信分享提示