本文关键词:linux合并zip文件、linux下zip分卷压缩及linux下zip分卷解压、linux下zip分卷解压、linux下zip分卷压缩。
先压缩原始文件
[root@laofuxi.com tmp]# zip -r mariadb.zip /root/src/mariadb-10.2.11-linux-x86_64.tar.gz
adding: root/src/mariadb-10.2.11-linux-x86_64.tar.gz (deflated 2%)
要看文件列表
[root@laofuxi.com tmp]# ls -l
total 439952
-rw-r–r– 1 root root 450510649 Sep 7 15:53 mariadb.zip
分卷为100M一个文件
[root@laofuxi.com tmp]# zip -s 100M mariadb.zip –out mariadb_test
copying: root/src/mariadb-10.2.11-linux-x86_64.tar.gz
要看文件列表
[root@laofuxi.com tmp]# ls -l
total 879904
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z01
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z02
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z03
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z04
-rw-r–r– 1 root root 31080253 Sep 7 15:54 mariadb_test.zip
-rw-r–r– 1 root root 450510649 Sep 7 15:53 mariadb.zip
合并所有分卷
[root@laofuxi.com tmp]# cat mariadb_test.z* > all.zip
要看文件列表
[root@laofuxi.com tmp]# ls -l
total 1319856
-rw-r–r– 1 root root 450510653 Sep 7 15:54 all.zip
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z01
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z02
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z03
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z04
-rw-r–r– 1 root root 31080253 Sep 7 15:54 mariadb_test.zip
-rw-r–r– 1 root root 450510649 Sep 7 15:53 mariadb.zip
解压合并后的zip文件
[root@laofuxi.com tmp]# unzip all.zip
Archive: all.zip
warning [all.zip]: zipfile claims to be last disk of a multi-part archive;
attempting to process anyway, assuming all parts have been concatenated
together in order. Expect “errors” and warnings…true multi-part support
doesn’t exist yet (coming soon).
warning [all.zip]: 419430400 extra bytes at beginning or within zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 419430404
(attempting to re-compensate)
inflating: root/src/mariadb-10.2.11-linux-x86_64.tar.gz
要看文件列表
[root@laofuxi.com tmp]# ls -l
total 1319856
-rw-r–r– 1 root root 450510653 Sep 7 15:54 all.zip
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z01
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z02
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z03
-rw-r–r– 1 root root 104857600 Sep 7 15:54 mariadb_test.z04
-rw-r–r– 1 root root 31080253 Sep 7 15:54 mariadb_test.zip
-rw-r–r– 1 root root 450510649 Sep 7 15:53 mariadb.zip
drwxr-xr-x 3 root root 17 Sep 7 15:55 root
查看解压后的文件的md5值
[root@laofuxi.com tmp]# md5sum root/src/mariadb-10.2.11-linux-x86_64.tar.gz
463992783249787d4d00f26e3f51306b root/src/mariadb-10.2.11-linux-x86_64.tar.gz
查看原始文件md5值
[root@laofuxi.com tmp]# md5sum /root/src/mariadb-10.2.11-linux-x86_64.tar.gz
463992783249787d4d00f26e3f51306b /root/src/mariadb-10.2.11-linux-x86_64.tar.gz
通过对比md5值,发现md5值是一样的,说明压缩及解压是正常的。
最后编辑:2018-09-11作者:劳福喜
这个作者貌似有点懒,什么都没有留下。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/179074.html原文链接:https://javaforall.cn
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有