Answers:
bzip2 块大小bzip2有一些块大小选项。从手册页bzip2(1):
-1 (or --fast) to -9 (or --best)
       Set the block size to 100 k, 200 k ..  900 k when compressing.
       Has no effect when decompressing. See MEMORY MANAGEMENT below.
       The --fast and --best aliases are primarily for GNU gzip
       compatibility. In particular, --fast doesn't make things
       significantly faster. And --best merely selects the default
       behaviour.
由于您希望更快地进行压缩,而无需考虑压缩率,因此bzip2,您似乎需要-1(或--fast)选项。
bzip2使用时设置块大小tar您可以bzip2通过tar两种方式设置块大小。
我最喜欢的方式是UNlX方式,您可以独立使用每种工具,然后通过管道将它们组合在一起。
$ tar --create [FILE...] | bzip2 -1 > [ARCHIVE].tar.bz2
您可以将其读为“使用tar-> 用-> bzip将.tar创建为->并将其bzip2写入[ARCHIVE].tar.bz2”。
也可以bzip2通过环境变量设置选项BZIP2。从手册页bzip2(1):
bzip2 will read arguments from the environment variables BZIP2 and BZIP,
in that order, and will process them before any arguments read from the
command line. This gives a convenient way to supply default arguments.
因此,将其与一起使用tar,您可以例如执行以下操作:
$ BZIP2=-1 tar --create --bzip2 --file [ARCHIVE].tar.bz2 [FILE...]
bzip2使用慢速压缩算法。如果您担心速度,可以研究其他算法,例如gzip或使用的算法lzop。这是一篇比较压缩工具的好文章:https : //aliver.wordpress.com/2010/06/22/huge-unix-file-compresser-shootout-with-tons-of-datagraphs/
它甚至更容易:
% tar -cvf dir.tar path/to/dir/ && bzip2 -9 dir.tar
tar有-z和-j。这些选择对我来说似乎很方便。但是他们可以节省一天。