1848633 Members
4241 Online
104033 Solutions
New Discussion

Re: Explode a *.gz file

 
SOLVED
Go to solution
Ayanda_2
Occasional Contributor

Explode a *.gz file

I want to Explode a file on Unix it's a .gz file , What is the command that I can use ?
14 REPLIES 14
twang
Honored Contributor
Solution

Re: Explode a *.gz file

# gunzip a*.gz
Enrico P.
Honored Contributor

Re: Explode a *.gz file

Hi,
gunzip
or
gzip -d

Enrico
Lilischkis
Occasional Contributor

Re: Explode a *.gz file

Hi,

Use gzip -dc file1.gz > file1
or
gzip -d file1.gz

For more information use
man gzip
or
gzip -h
Ayanda_2
Occasional Contributor

Re: Explode a *.gz file

Thank you , This file was exploded correctly but now it created a *.tar file and how do I explode that one ?
twang
Honored Contributor

Re: Explode a *.gz file

# tar xvf a*.tar
Massimo Bianchi
Honored Contributor

Re: Explode a *.gz file

Hi,
pay attention that a *.tar file can explode files in every directory.

use

tar -tvf yourfile.tar


to see the content. pay attention to absolute/relativa path, or you may overwrite something usefull.

to extract

tar -xvf yourfile.tar

Massimo
T G Manikandan
Honored Contributor

Re: Explode a *.gz file


#gunzip a.tar.gz
#tar xvf a.tar


ÁõÔÆ·É
Advisor

Re: Explode a *.gz file

Should I use the full path for the gunzip?
H.Merijn Brand (procura
Honored Contributor

Re: Explode a *.gz file

no, you don't need the full path

GNU tar has gzip builtin:

# gtar -tzvf file.tgz

for an index

# gtar -xvzf file.tgz to extract

Mind you that GNU tar *by default* strips all leading slashes, so it does not have the side effect mentioned above that files can be extracted all over your system

Enjoy, have FUN! H.Merijn

( GNU tar available on my ITRC site: https://www.beepz.com/personal/merijn/ or http://www.cmve.net/~merijn/ )
Enjoy, Have FUN! H.Merijn
Umapathy S
Honored Contributor

Re: Explode a *.gz file

Ayanda,
My 2 cents.

You can combine tar and gzip. When you want to extract/view the files from the gzipped-tarred file use this.

gunzip -c tmp_file.tar.gz|tar -xvf -

You have to use tar -tvf instead of -xvf for viewing the content.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
yogesh_4
Regular Advisor

Re: Explode a *.gz file

Hi,
# gunzip .gz should help.
Donny Jekels
Respected Contributor

Re: Explode a *.gz file

I preffer gtar!

# gtar -xvzf file.tgz

regular tar has a bad history. ...
"Vision, is the art of seeing the invisible"
Caesar_3
Esteemed Contributor

Re: Explode a *.gz file

Hello!

gunzip -c .tar.gz | tar xf -

Or use the gnu tar, download from:
http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.13.25/

gtar xzf .tar.gz

Caesar
Patrick Wallek
Honored Contributor

Re: Explode a *.gz file

Some more information for everyone. You can un-tar a gzip'ed tar file WITHOUT gunzip'ing it first.

If you want to un-tar the entire file you can do the following:

# gzcat file.tar.gz | tar -xvf -

If you want to extract a single file out of the file.tar.gz file, you can do:

# gzcat file.tar.gz | tar -xvf - filename

or

# gzcat file.tar.gz | tar -xvf - dir/filename