前言:
xz这个压缩工具可能很多人都很陌生,xz是绝大数linux默认就带的一个压缩工具。在压缩率上甚至比7z还要小,在需要将文件极致压缩的情况下,是一个给力的工具:
Usage: xz [OPTION]... [FILE]...
Compress or decompress FILEs in the .xz format.
-z, --compress force compression
-d, --decompress, --uncompress
force decompression
-t, --test test compressed file integrity
-l, --list list information about .xz files
-k, --keep keep (don't delete) input files
-f, --force force overwrite of output file and (de)compress links
-c, --stdout, --to-stdout
write to standard output and don't delete input files
-0 ... -9 compression preset; default is 6; take compressor *and*
decompressor memory usage into account before using 7-9!
-e, --extreme try to improve compression ratio by using more CPU time;
does not affect decompressor memory requirements
-T, --threads=NUM use at most NUM threads; the default is 1; set to 0
to use as many threads as there are processor cores
-q, --quiet suppress warnings; specify twice to suppress errors too
-v, --verbose be verbose; specify twice for even more verbose
-h, --help display this short help and exit
-H, --long-help display the long help (lists also the advanced options)
-V, --version display the version number and exit
With no FILE, or when FILE is -, read standard input.
Report bugs to <lasse.collin@tukaani.org> (in English or Finnish).
XZ Utils home page: <http://tukaani.org/xz/>
上面就是xz命令的用法,简单的来说呢,xz命令考虑的是极致的压缩率,一般情况下tar -czvf tar-zxvf都可以解决问题了,值得一提的是,xz命令不支持对文件夹压缩,如果需要压缩文件夹,则可以先将其转为tar包,而后再xz
xz -kz9 test.tar 不删除原文件的压缩(xz -z9则为删除原文件)
xz -kd 不删除原文件的解压(xz -d则为删除原文件的解压)
pixz命令是需要自己安装的,可以使用cpu多线程的来进行压缩,大大减少xz命令的压缩时间。使用链接https://www.kutu66.com/GitHub/article_56016,github地址http://www.github.com/vasi/pixz