轻松管理大文件:Linux Tar 分割与分片压缩与解压操作指南
最编程
2024-02-23 17:51:48
...
文件压缩
tar -zcvf test.tar.gz test/
-z:是否同时具有gzip属性,是否需要gzip压缩;
-c:建立一个压缩文件指令;
-v:压缩过程中是否显示文件;
-f :使用档名;
文件分割
split -b 40M -d -a 2 test.tar.gz test.tar.gz.
-b:指定每个文件的大小,单位可以为B、K、M ;
-d:使用数字而不是字母作为后缀名 ;
-a:后缀名长度,默认为2;
文件压缩加分割
tar -cvf - test | split -b 1M - test.tar.gz.
注意一下指令中的两个“-”,如果分开执行,就不用”-”。为什么有这个”-”?
man tar
-f, –file [HOSTNAME:]F
Use archive file or device F (default “-”, meaning stdin/stdout). Note that “/dev/stdout” is not equivalent to “-”.Using “/dev/stdout” explicitly can lead to corrupted archive, especially when coupled with “-v”.
文件合并
cat test.tar.gz.* > test_new.tar.gz
文件解压
tar -zxvf test_new.tar.gz -C ./Directory/
-z:是否同时具有gzip属性,是否需要gzip压缩;
-x:解压缩指令;
-v:压缩过程中是否显示文件;
-f :使用档名;
参考地址:
Linux tar 压缩、解压、分割、合并文件:https://blog.****.net/qq_41979513/article/details/98763608
Linux Tar Split压缩解压缩分片压缩解压缩:https://blog.****.net/jiayanhui2877/article/details/14222701
推荐阅读
-
详解在Linux中使用tar命令进行文件压缩与解压的操作指南
-
详解在Linux中使用tar命令进行文件压缩与解压的操作指南
-
如何在Linux中轻松使用tar命令进行文件压缩与解压缩操作
-
如何在Linux中轻松操作tar命令进行文件压缩与解压
-
在Linux中,轻松操作:tar解压至当前文件夹,以及zip和tar的压缩与解压教程(简单明了)
-
详解在Linux中使用tar命令进行文件压缩与解压的操作指南
-
详细讲解 Linux 中的 tar.gz、tar、bz2、zip 压缩与解压缩操作指南
-
轻松掌握 Linux tar 工具:压缩、解压、加密与解密操作指南
-
轻松管理大文件:Linux Tar 分割与分片压缩与解压操作指南
-
如何在Linux中轻松操作:用tar命令压缩与解压.tar.bz2文件