找回密码
 立即注册
查看: 1560|回复: 0

tar不能解压.zip格式包的原因及解决办法

[复制链接]

6806

主题

10

回帖

2万

积分

管理员

积分
21879
发表于 2019-5-20 20:03:35 | 显示全部楼层 |阅读模式
刚刚在学习linux的过程中,下载了zip压缩包,用tar命令无法解压,提示错误如下:

gzip: stdin has more than one entry--rest ignored

tar: Child returned status 2

tar: Error is not recoverable: exiting now


然后,只有使用unzip命令来解压才能成功。

虽然问题解决了,但是为啥呢?

原因如下:

详情可见:http://lists.gnu.org/archive/html/bug-tar/2008-09/msg00014.html

原来tar也是间接调用了gzip,而gzip的使用是有限制的:Files created by zip can be uncompressed by gzip only if they have a single member compressed with the 'deflation' method.

也就是说单文件用deflation压缩的包才可以用gzip解压,好在有workaround ---- unzip

unzip用法也非常简单,直接敲unzip 就有提示,最后一句命令搞定:

unzip adt-bundle-linux-x86_64-20131030.zip -d /home/administrator/work/adt2/

-d为指定输出文件夹,不制定貌似就放到pwd,当前文件夹了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表