Mac OS X 10.8.4下面XZ Utils(*.tar.xz)压缩解压缩命令工具的安装

来源:互联网 发布:nginx clientbodytemp 编辑:程序博客网 时间:2024/04/29 14:36
主要参考:http://bbs.chinaunix.net/thread-3610738-1-1.html

现在很多找到的软件都是tar.xz的格式的,xz 是一个使用 LZMA压缩算法的无损数据压缩文件格式。 和gzip与bzip2一样,同样支持多文件压缩,但是约定不能将多于一个的目标文件压缩进同一个档案文件。 相反,xz通常作为一种归档文件自身的压缩格式,例如使用tar或cpioUnix程序创建的归档。 xz 在GNU coreutils(版本 7.1 或更新) 中被使用。 xz 作为压缩软件包被收录在 Fedora (自Fedora 12起) , Arch Linux , FreeBSD、 Slackware Linux、CRUX 和 Funtoo中。

xz utils 是 lzma utils 的下一代lzma utils 改名 xz utils。
压缩时 xz utils 耗时比 bzip2 长一倍,
压缩时 xz utils 耗时是 lzma utils 一半,
压缩时 xz utils 生成文件体积是 bzip2 的一半,
压缩时 xz utils 生成文件体积比 lzma utils 略大,
解压时 xz utils 耗时是 bzip2 的三分之一,
解压时 xz utils 速度比 lzma utils 略快,
解压时 xz utils 耗时仅比 gzip 多一倍。
压缩时 xz utils 使用 *.xz 格式 生成文件 比 *.lzma 格式 略大,
测试样本较小,多次测试结果有出入,无法判断 xz utils 使用 *.xz 与 *.lzma 格式 压缩与解压时间 谁占优势。

到目前为止,lzma utils 的压缩率仍是最大的,xz utils 解压时间占优势。
一个 xz 文件格式的实现XZ 实用程序已可在网上自由获得。GNU tar自版本1.22起使用这一软件透明支持xz文件格式(就如同其处理gzip格式或者bzip2格式一样)。  随着大量软件进入了公有领域(例如 liblzma等) 程序的4.999.9beta版本实现在GNU LGPL 和 GNU GPL条款下发布。

7-Zip在9.04 beta版支持了xz文件格式。 

首先到[url]http://download.chinaunix.net/download/0014000/13078.shtml[/url]
或:
http://download.csdn.net/detail/duanyipeng/6018631

页面下载xz-5.0.3.tar.bz2解压工具,然后编译安装
tar -xf xz-5.0.3.tar
cd xz-5.0.3
./configure
make
make install

这样就可以用xz命令来解压tar.xz格式文件,
  1. xz -d linux-3.1-rc4.tar.xz

  2. tar -xvf linux-3.1-rc4.tar
复制代码
这里是下载了linux的内核源码,可以明显的看到tar.xz只有几十M大小,而解压后是几百兆的,这个确实压缩比率很高的。

附帮助:
[plain] view plaincopy
  1. jonesduan-MacBook-Pro:Linux_Kernel_Release user$ xz --help  
  2. Usage: xz [OPTION]... [FILE]...  
  3. Compress or decompress FILEs in the .xz format.  
  4.   
  5.   -z, --compress      force compression  
  6.   -d, --decompress    force decompression  
  7.   -t, --test          test compressed file integrity  
  8.   -l, --list          list information about .xz files  
  9.   -k, --keep          keep (don't delete) input files  
  10.   -f, --force         force overwrite of output file and (de)compress links  
  11.   -c, --stdout        write to standard output and don't delete input files  
  12.   -0 ... -9           compression preset; default is 6; take compressor *and*  
  13.                       decompressor memory usage into account before using 7-9!  
  14.   -e, --extreme       try to improve compression ratio by using more CPU time;  
  15.                       does not affect decompressor memory requirements  
  16.   -q, --quiet         suppress warnings; specify twice to suppress errors too  
  17.   -v, --verbose       be verbose; specify twice for even more verbose  
  18.   -h, --help          display this short help and exit  
  19.   -H, --long-help     display the long help (lists also the advanced options)  
  20.   -V, --version       display the version number and exit  
  21.   
  22. With no FILE, or when FILE is -, read standard input.  
  23.   
  24. Report bugs to <lasse.collin@tukaani.org> (in English or Finnish).  
  25. XZ Utils home page: <http://tukaani.org/xz/>  
  26. jonesduan-MacBook-Pro:Linux_Kernel_Release user$  

*.tar.bz2:
打包:tar -jcvf test.tar.bz2 test/
解包:tar -jxvf test.tar.bz2

*.tar.gz:
打包:tar -zcvf test.tar.gz test/
解包:tar -zxvf test.tar.gz

*.tar:
打包:tar -cvf test.tar test/
解包:tar -xvf test.tar

*.tar.xz:
打包:xz -z test.tar // 会将test.tar压缩为test.tar.xz,并删除原始test.tar文件

解包:xz -d test.tar.xz // 会将test.tar.xz解压为test.tar,并删除原始test.tar.xz文件


转自:http://blog.csdn.net/duanyipeng/article/details/10384097

0 0
原创粉丝点击