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
。
分类:
linux shell
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!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语言中循环语句汇总