xz 压缩文件解压
linux
2016-12-14 11:53
1,压缩
xz -z 要压缩的文件
如果要保留被压缩的文件加上参数 -k ,如果要设置压缩率加入参数 -0 到 -9调节压缩率。如果不设置,默认压缩等级是6。
2,解压
xz -d 要解压的文件
同样使用 -k 参数来保留被解压缩的文件。
3,tar.xz
创建tar.xz文件:要先 tar cvf file.tar dir/ 这样创建file.tar文件先,然后使用 xz -z file.tar 来将 file.tar压缩成为 file.tar.xz
解压tar.xz文件:先 xz -d file.tar.xz 将 file.tar.xz解压成 file.tar 然后,再用 tar xvf file.tar来解包。
4,help
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 the number of 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/>