xz 文件压缩解压工具

发布时间: 更新时间: 总字数:465 阅读时间:1m 作者: IP上海 分享 网址



xz 通常作为一种归档文件自身的压缩格式,例如使用 tar创建的归档。因此,当需要解压 abc.tar.xz 文件时,应先执行 xz -d abc.tar.xz 解压成 abc.tar 文件,再执行 tar -xvf abc.tar 进行解压


apt install xz-utils


xz --help ...
$ xz --help
Usage: xz [OPTION]... [FILE]...
Compress or decompress FILEs in the .xz format.

  -z, --compress      force compression 强制压缩
  -d, --decompress    force decompression 强制解压缩
  -t, --test          test compressed file integrity 测试压缩文件的完整性
  -l, --list          list information about .xz files 列出有关.xz文件的信息
  -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; default is 6; take compressor *and*
                      decompressor memory usage into account before using 7-9! 压缩预设;默认值为6
  -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: <https://tukaani.org/xz/>


# 压缩
tar cvf hosts.tar /etc/hosts
xz -z hosts.tar

# 压缩后的文件
$ ls
$ hosts.tar.xz
hosts.tar.xz: XZ compressed data, checksum CRC64

# 解压
xz -d hosts.tar.xz
tar xvf hosts.tar


  1. https://tukaani.org/xz/
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数