Linux系统split对tar文件进行分片和压缩

一.简单说明

在实际的使用场景中,我们可能对压缩过的tar包上传到某个服务器或者应用,会涉及超出服务器限制的文件大小。这里我们可以对此文件进行压缩、分片、合并。

二.实际操作

2.1 压缩包分片

这里,我有个7.5G的tar.gz的压缩包,由于上传的服务器的限制,单次只能上传到700M,这里我们对此文件进行分片:

[root@yuhaohao test]# ls -alh test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz
-rw-r--r-- 1 root root 7.5G May 18 10:24 test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz
[root@yuhaohao test]# split -b 700M test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz. --verbose
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.aa’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ab’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ac’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ad’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ae’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.af’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ag’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ah’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ai’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.aj’
creating file ‘test-1.5.4.1_patch-1.5.2.1_2020-05-15.tar.gz.ak’

2.2 合并

猜你喜欢

转载自www.cnblogs.com/yuhaohao/p/12911825.html
今日推荐