你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux下解压tar.xz格式压缩文件

[日期:2013-03-24] 来源:Linux社区  作者:longerzone [字体:大 中 小]

可以看到,xz的用法为:  xz [option]...  [file]...

而对应的操作有:
 
 -z, --compress
              Compress.  This is the default operation mode when no operation mode option is specified and no other operation  mode  is implied from the command name (for example, unxz implies --decompress).
 压缩,而且这是默认的操作,也就是说没有操作数的话 xz 加上文件就是压缩!(unxz 可以用来解压)
 
-d, --decompress, --uncompress
              Decompress.
 解压缩。和 -z 效果相反
 
-t, --test
              Test  the integrity of compressed files.  This option is equivalent to --decompress --stdout except that the decompressed data is discarded instead of being written to standard output.  No files are created or removed.
 测试压缩文件的完整性,这个操作不会生成解压缩文件。
 
-l, --list
              Print information about compressed files.  No uncompressed output is produced, and no files are created or  removed.  In list mode, the program cannot read the compressed data from standard input or from other unseekable sources.
 

这个操作会打印文件的信息,不会生成解压缩文件!

所以,我们从内核官网下载的压缩文件可以使用下面两个操作进行解压:
 
1.首先使用xz解压 tar.xz文件:  xz  -d  linux-3.8.4.tar.xz 
 
这个操作会将linux-3.8.4.tar.xz文件解压成 linux-3.8.4.tar,然后我们再对 linux-3.8.4.tar 进行解压。
 
【注】:使用 xz 进行压缩和解压过程中都会直接在原文件上进行,比如说对 tar.xz 解压后直接就剩下 tar 了,而没有了原 tar.xz 文件。可以加 -k 参数(keep)进行保留原文件
 
2.对linux-3.8.4.tar解压:tar -xvf  linux-3.8.4.tar  操作完成

最后再补充下 xz utils 的知识:
 
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文件格式,也就是说在windows下遇到 xz 压缩文件可以使用 7-Zip 解压。

linux
相关资讯       Linux下解压tar.xz  tar.xz如何解压 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 匿名 发表于 2013/3/25 22:28:32
执行上述步骤后,出现不可预料的输入后果这一提示,怎么办,在解压前需要将原内核文件夹删除么?