【linux】使用split命令拆分tar.gz 压缩包

操作步骤

(1)打包文件:
tar -cvf 20190816.tar 20190816

(2)分割文件:

#例子1
split -b 3G -d -a 1 20190816.tar 20190816.tar.
#例子2
split -b 40000K -d -a 1 go_1.7.tar.gz go_1.7.tar.gz.
# 例子3
split -b 40m -d -a 2 ISTP.tar ISTP.tar.

执行后的效果

-rw-r--r--  1 root     root      4194304000 May 20 14:00 cm-11.tar.gz.0
-rw-r--r--  1 root     root      4194304000 May 20 14:02 cm-11.tar.gz.1
-rw-r--r--  1 root     root      4194304000 May 20 14:03 cm-11.tar.gz.2
-rw-r--r--  1 root     root      4194304000 May 20 14:05 cm-11.tar.gz.3
-rw-r--r--  1 root     root      4194304000 May 20 14:06 cm-11.tar.gz.4
-rw-r--r--  1 root     root      4194304000 May 20 14:08 cm-11.tar.gz.5
-rw-r--r--  1 root     root      4194304000 May 20 14:09 cm-11.tar.gz.6
-rw-r--r--  1 root     root      2256379886 May 20 14:10 cm-11.tar.gz.7

参数解析
-b 3G 表示设置每个分割包的大小,单位还是可以k
-d "参数指定生成的分割包后缀为数字的形式
-a x来设定序列的长度(默认值是2),这里设定序列的长度为1

(3)合并分割后压缩包,并解压
cat 20190816.tar.* >new_20190816.tar
tar-xvf new_20190816.tar

split 命令详解

Mandatory arguments to long options are mandatory for short options too.
  -a, --suffix-length=N   use suffixes of length N (default 2)
  -b, --bytes=SIZE        put SIZE bytes per output file
  -C, --line-bytes=SIZE   put at most SIZE bytes of lines per output file
  -d, --numeric-suffixes  use numeric suffixes instead of alphabetic
  -l, --lines=NUMBER      put NUMBER lines per output file
      --verbose           print a diagnostic to standard error just
                            before each output file is opened
      --help     display this help and exit
      --version  output version information and exit

SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.

-b 的参数可以是 数字,也可以是K (1 KB),或者m (1 mb)

例子3

split -b 40m -d -a 2 ISTP.tar ISTP.tar.

参考链接
https://blog.csdn.net/weixin_28755447/article/details/116555214

参考工具
字节计算器
https://calc.itzmx.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bug 挖掘机

支持洋子

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值