1828578 Members
2766 Online
109982 Solutions
New Discussion

*.tar.gz file

 
Dlomo
New Member

*.tar.gz file

Hi , I have a file.tar.gz file
I want to unpack it on linux
How do I do it

Please help
5 REPLIES 5
Kodjo Agbenu
Honored Contributor

Re: *.tar.gz file

Either :

gunzip file.tar.gz
tar xvf file.tar

or :

tar xzvf file.tar.gz

or :

zcat file.tar.gz | tar xvf -


Good luck.

Kodjo
Learn and explain...
Vincent Stedema
Esteemed Contributor

Re: *.tar.gz file

or: gunzip -c file.tar.gz | tar xvf -
John Meissner
Esteemed Contributor

Re: *.tar.gz file

I prefer Kodjo's first method

gunzip file.tar.gz
tar -xvf file.tar

just some quick notes on gunzip and tar:

to zip a file type gzip file
to unzip a file type gunzup file.gz

to create a tar file type:
tar -cvf tarfilename file1 file2 file3 and so on

to look at the contents of a tar file type:
tar -tvf tarfilename

to extract a tarfile type:
tar -xvf tarfilename

hope this helps
All paths lead to destiny
Stuart Browne
Honored Contributor

Re: *.tar.gz file

Just thought I'd toss my $0.02 in here too.

Given that we're using Linux (in this group at least), this means that for the most of us, we'd be using GNU 'tar'.

GNU tar has some lovely little compression plugins already, so you can do fun things like:

tar ztvf file.tar.gz

to list back files in a G-Zipped Tar file. You can also create directly into such a tarball by using:

tar zcf file.tar.gz

Now, if you didn't want to use GZip compression, but something like 'bzip', you could use the 'j' flag (unless it was older than tar 1.20 or some such, where it was 'I'. This was changed for compatability reasons).

Not only that, if you wanted to use your own compression routine, you could just tell it to use your own:

tar cvf --use-compress-program /my/comperss/program file.tar.mycompress

All is neatly laid out in the manual page of course.

NOTE: All the previous examples in the other threads are also quite valid, and will work. Just not as efficient as it could be.
One long-haired git at your service...
Chakravarthi
Trusted Contributor

Re: *.tar.gz file

use tar xvfz file.tar.gz