linux 中 gzip命令设置压缩等级
001、生成测试文件
[root@pc1 test]# ls [root@pc1 test]# seq -f %010g 10000000 > a.txt ## 测试文件 [root@pc1 test]# ll -h total 113M -rw-r--r--. 1 root root 113M Jan 9 12:03 a.txt ## 测试文件 113Mb
002、gzip不同的压缩等级,压缩等级可以设置为1-9,最低为1, 最高为9
[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 [root@pc1 test]# gzip -1 -c a.txt > 1.gz ## 设置最低压缩等级为1 [root@pc1 test]# gzip -2 -c a.txt > 2.gz [root@pc1 test]# gzip -4 -c a.txt > 4.gz [root@pc1 test]# gzip -9 -c a.txt > 9.gz ## 设置最高压缩等级为9 [root@pc1 test]# ls 1.gz 2.gz 4.gz 9.gz a.txt [root@pc1 test]# ll -h ## 比较不同压缩等级后文件的大小 total 135M -rw-r--r--. 1 root root 7.0M Jan 9 12:09 1.gz -rw-r--r--. 1 root root 7.0M Jan 9 12:09 2.gz -rw-r--r--. 1 root root 4.7M Jan 9 12:09 4.gz -rw-r--r--. 1 root root 3.8M Jan 9 12:10 9.gz -rw-r--r--. 1 root root 113M Jan 9 12:03 a.txt
。
分类:
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语言中循环语句汇总