ainer\">说明:很多场景需要拷贝或传输文件时,如果我们需要拷贝的文件太大的话,就需要想办法将其分成小个文件进行拷贝,然后载重新合并。今天介绍split命令格式:split
ainer\">
说明:很多场景需要拷贝或传输文件时,如果我们需要拷贝的文件太大的话,就需要想办法将其分成小个文件进行拷贝,然后载重新合并。今天介绍 split 命令
格式:
<span>split</span> <span>[OPTION]</span> <span>[INPUT [PREFIX]</span>]
一、压缩并切割
使用tar命令进行压缩,使用split进行切割
实例:
# 压缩]# <span>tar</span> <span>-zcvf</span> <span>nginx-v1</span><span>.23</span><span>.1</span><span>.tar</span><span>.gz</span> <span>nginx-v1</span><span>.23</span><span>.1</span># 查看<span>MD5</span>值]# <span>md5sum</span> <span>nginx-v1</span><span>.23</span><span>.1</span><span>.tar</span><span>.gz</span><span>a555bd1453c9e66551b4077d28ab7df3</span> <span>nginx-v1</span><span>.23</span><span>.1</span><span>.tar</span><span>.gz</span># 切割,指定大小为10<span>M</span>,以数字方式后缀]# <span>split</span> <span>-b</span> 10<span>m</span> <span>-d</span> <span>nginx-v1</span><span>.23</span><span>.1</span><span>.tar</span><span>.gz</span> <span>nginx</span>]# <span>ls</span><span>nginx00</span> <span>nginx01</span> <span>nginx02</span> <span>nginx03</span> <span>nginx04</span> <span>nginx05</span> <span>nginx06</span> <span>nginx-v1</span><span>.23</span><span>.1</span> <span>nginx-v1</span><span>.23</span><span>.1</span><span>.tar</span><span>.gz</span>参数说明 <span>-b</span>: 指定大小<span>-d</span> : 使用数字后缀而不是字母
二、解压
<span># 创建一个新目录用来存放分割文件</span>]<span># mkdir src</span>[root@localhost test]<span># mv nginx0* src/</span><span># 解压分割文件</span>[root@localhost test]<span># cd src/</span>[root@localhost src]<span># cat nginx0* >nginx-v1.23.1.tar.gz</span>[root@localhost src]<span># ls</span>nginx00 nginx01 nginx02 nginx03 nginx04 nginx05 nginx06 nginx-v1<span>.23</span><span>.1</span>.tar.gz<span># 核对MD5值</span>[root@localhost src]<span># md5sum nginx-v1.23.1.tar.gz </span>a555bd1453c9e66551b4077d28ab7df3 nginx-v1<span>.23</span><span>.1</span>.tar.gz[root@localhost src]<span># </span>
本站部分文章来自网络或用户投稿,如无特殊说明或标注,均为本站原创发布。涉及资源下载的,本站旨在共享仅供大家学习与参考,如您想商用请获取官网版权,如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。