Extract a gzip compressed tar archive in Linux

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: Linux  

The version of tar in most Linux distributions supports gzip compression. This means that a gzipped tar file can be extracted in one simple command.


To extract the archive filename.tar.gz into the current directory:

tar xzf filename.tar.gz

If this fails, the version of tar may not support gzip compression. In this case, you can use the traditional two-stage command:

gzip -dc filename.tar.gz | tar xf -

 

10 Comments -


  1. santhosh said on June 4, 2009

    i got the following error when i extracted.
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error exit delayed from previous errors.
    Plz suggest any way to extract in linux?

  2. Anonymous said on September 2, 2009

    santhosh are you sure its not a bzip not gzip

  3. Anonymous said on November 27, 2009

    Sorry Bozzzzzzzz! it won’t worked for me

  4. sikat ang pinoy said on January 13, 2010

    It won’t work for me I think gunzip is another option to unzip gzip file.

  5. Bubu said on August 18, 2010

    good stuff

  6. Rahul B said on January 7, 2011

    gunzip file.tar.gz

    it will give file.tar

    then type command tar -xvf

  7. Rahulbiliye said on January 7, 2011

    gunzip file.tar.gz
    u get file.tar
    tar -xvf file.tar

  8. Thiyagarajan Veluchamy said on January 27, 2011

    Thanks

  9. S_raparty said on May 16, 2011

    Good thanx Rahul 

  10. Pete said on August 31, 2011

    one liner
    tar -zxvf file.tar.gz

    extracts all to current dir

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -