最近在安装国外的开源软件的时候,总是下载到后缀名为xz的文件,乍一看听新鲜的,没有解压过xz文件,就在google上学习了一下,并且记录了一下这个命令的用法。
安装
一般Linux/Unix都默认安装了xz命令,如果没有安装,需要进行安装,安装方法非常简单, 在centos下,直接运行:
yum install xz
也可以使用源码包安装: 先下载该工具源码包http://tukaani.org/xz/ 下载后解压进入该目录运行configure生成makefile文件用—prefix指定安装目录
./configure --prefix=/usr/local/xz
make && make install
ln -s /usr/local/xz/bin/xz /bin/xz
命令参数
[root@xvmlabs data]# xz --help
Usage: xz [OPTION]... [FILE]...
Compress or decompress FILEs in the .xz format.
Mandatory arguments to long options are mandatory for short options too.
-z, --compress force compression(强制压缩)
-d, --decompress force decompression(强制解压)
-t, --test test compressed file integrity(测试压缩文件完整性)
-l, --list list information about files(列出相关文件的信息)
-k, --keep keep (don't delete) input files(保留(不要删除)输入文件)
-f, --force force overwrite of output file and (de)compress links
(强制覆盖输出文件和压缩链接)
-c, --stdout write to standard output and don't delete input files
(写入标准输出,不要删除输入文件)
-0 .. -9 compression preset; 0-2 fast compression, 3-5 good
(压缩预设; 0-2快速压缩,3-5好)
compression, 6-9 excellent compression; default is 6
(压缩,6-9优秀压缩; 默认为6))
-e, --extreme use more CPU time when encoding to increase compression
(编码时使用更多的CPU时间来增加压缩)
ratio without increasing memory usage of the decoder
(比例,而不增加解码器的内存使用)
-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(显示帮助信息))
-H, --long-help display the long help (lists also the advanced options)
(显示长期帮助(还列出了高级选项))
-V, --version display the version number(显示版本号)
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/>