How to extract filename.tar.gz file

后端 未结 8 2111
半阙折子戏
半阙折子戏 2020-12-12 12:47

I want to extract an archive named filename.tar.gz.

Using tar -xzvf filename.tar.gz doesn\'t extract the file. it is gives this error:

相关标签:
8条回答
  • 2020-12-12 13:13

    Internally tar xcvf <filename> will call the binary gzip from the PATH environment variable to decompress the files in the tar archive. Sometimes third party tools use a custom gzip binary which is not compatible with the tar binary. It is a good idea to check the gzip binary in your PATH with which gzip and make sure that a correct gzip binary is called.

    0 讨论(0)
  • 2020-12-12 13:14

    It happens sometimes for the files downloaded with "wget" command. Just 10 minutes ago, I was trying to install something to server from the command screen and the same thing happened. As a solution, I just downloaded the .tar.gz file to my machine from the web then uploaded it to the server via FTP. After that, the "tar" command worked as it was expected.

    0 讨论(0)
  • 2020-12-12 13:20

    As far as I can tell, the command is correct, ASSUMING your input file is a valid gzipped tar file. Your output says that it isn't. If you downloaded the file from the internet, you probably didn't get the entire file, try again.

    Without more knowledge of the source of your file, nobody here is going to be able to give you a concrete solution, just educated guesses.

    0 讨论(0)
  • 2020-12-12 13:22

    A tar.gz is a tar file inside a gzip file, so 1st you must unzip the gzip file with gunzip -d filename.tar.gz , and then use tar to untar it. However, since gunzip says it isn't in gzip format, you can see what format it is in with file filename.tar.gz, and use the appropriate program to open it.

    0 讨论(0)
  • 2020-12-12 13:23

    I have the same error the result of command :

    file hadoop-2.7.2.tar.gz
    

    is hadoop-2.7.2.tar.gz: HTML document, ASCII text

    the reason that the file is not gzip format due to problem in download or other.

    0 讨论(0)
  • 2020-12-12 13:26

    If file filename.tar.gz gives this message: POSIX tar archive, the archive is a tar, not a GZip archive.

    Unpack a tar without the z, it is for gzipped (compressed), only:

    mv filename.tar.gz filename.tar # optional
    tar xvf filename.tar
    

    Or try a generic Unpacker like unp (https://packages.qa.debian.org/u/unp.html), a script for unpacking a wide variety of archive formats.

    determine the file type:

    $ file ~/Downloads/filename.tbz2
    /User/Name/Downloads/filename.tbz2: bzip2 compressed data, block size = 400k
    
    0 讨论(0)
提交回复
热议问题