解决tar命令解压文件报错:gzip: stdin: not in gzip format

错误描述

Apache ZooKeeper上下载了Apache ZooKeeper 3.7.0的安装包,但是在使用“tar zxf”解压文件的时候,报如下错误:gzip: stdin: not in gzip format
file

问题分析

  • 看报错描述,stdin: not in gzip format,其实已经说明了问题所在,即文件不是gzip格式。可以使用“file”命令查看文件的具体信息:
    file apache-zookeeper-3.7.0-bin.tar.gz.1 
    apache-zookeeper-3.7.0-bin.tar.gz.1: HTML document, ASCII text, with very long lines
  • 发现这个文件是 HTML document。回到Apache ZooKeeper官网,我最开始下载的文件是直接复制下图的链接,然后用wget命令下载的文件。
    file
  • 接下来我先点击“Apache ZooKeeper 3.7.0”,然后发现里面还有一个下载链接,使用这个里面的下载链接下载文件之后,tar解压成功:
    file
    新的文件,用file名称查看内容如下,说明的确是一个gzip文件:

    file apache-zookeeper-3.7.0-bin.tar.gz 
    apache-zookeeper-3.7.0-bin.tar.gz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

总结

  • tar zvf命令报“gzip: stdin: not in gzip format”,根因还是文件格式的问题。所以如果你遇到同样的报错,就需要检查一下你的文件来源是否就不对。
  • 我遇到这个报错,其实是因为我第一步下载文件的时候,其实只是将链接所对应的网页保存下来,而网页的最终路径刚好是:apache-zookeeper-3.7.0-bin.tar.gz,所以看起来像是一个压缩文件,实则是一个HTML文本文件

发布者:CoolQA,转转请注明出处:https://www.amwalle.com/more/working/20210516-gzip-stdin-not-in-gzip-format.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
CoolQA的头像CoolQA
上一篇 2021年5月9日 06:51
下一篇 2021年5月30日 07:04

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理