bzip压缩

  • bzip2使用方法 ```bash $ bzip2 -h bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010.

    usage: bzip2 [flags and input files in any order]

    -h —help print this message -d —decompress force decompression -z —compress force compression -k —keep keep (don’t delete) input files -f —force overwrite existing output files -t —test test compressed file integrity -c —stdout output to standard out -q —quiet suppress noncritical error messages -v —verbose be verbose (a 2nd -v gives more) -L —license display software version & license -V —version display software version & license -s —small use less memory (at most 2500k) -1 .. -9 set block size to 100k .. 900k —fast alias for -1 —best alias for -9

    If invoked as `bzip2’, default action is to compress.

    1. as `bunzip2', default action is to decompress.
    2. as `bzcat', default action is to decompress to stdout.

    If no file names are given, bzip2 compresses or decompresses from standard input to standard output. You can combine short flags, so `-v -4’ means the same as -v4 or -4v, &c.


- bzip2 不保留源文件压缩,会删除源文件只留下压缩文件
```bash
bzip2 test.tar
# 结果不会保留test.tar,生成test.tar.bz2
  • bzip2 保留源文件压缩,不会删除源文件
    bzip2 -k test.tar
    # 结果会保留test.tar,且生成test.tar.bz2
    

    split大文件分割

    更详细的用法可以查看https://blog.csdn.net/qq_34485930/article/details/79932967
    # 可以看到-b把每个文件切成2G大小的文件的后缀不是aa变成了000这是-d的效果,用数字后缀,-a 3是后缀3个,如果-a 4 后缀就变成了0000
    split -C 2G -d -a 3 test.tar.bz2 new_
    

合并split分割的文件

# cat 分割的文件名 > 合并后的文件名
cat new_* > test.tar.bz2

windows下合并split分割的文件

copy /b new_*  test.tar.bz2

使用md5检验分割合并后是否正确

计算文件md5值