Friday, October 2, 2009

gunzip, uncompress file.gz to another/different directory

Ariel asked me to help him in unzipping his file.gz which is on a directory/disk that has no space to unzip, he wanted unzip to another directory/disk which had enough space to house unzipped files.

initially i was checking gunzip manual but didn't found any option to do this kind of task, though at freenode someone told me to use zcat instead of gunzip! e.g.


$zcat filename.gz > /path/to/unzipped/file

so sometimes instead of reading command's manual we need to check command's capabilities ;)

cheers

8 comments:

SOHAIL AKHTAR said...

Its a nice tip

Thnx for sharing :)

SOHAIL AKHTAR said...

to unzip the file, can't we move the zip file to that directory (where space is more) and then unzip using bzip or other etc

nayyares said...

Sohail, we can for sure do it,problem in my case was. we did'nt had enough space to host the zipped & unzipped files on same disk. so we had to send unzipped file to separate disk.

Zohan said...

Thanks buddy, you saved my day!

Alex said...

There are many good softwares for resolve other problems with zip files, but one of them liked me and I used it. It was perfect and helped me much, moreover this software could resolve my old troubles and would aid in other situation also - either multiple or corrupt zip archive error.

SSIDJeff said...

I imported a zip file onto my solaris 10 server. The /var directory is not big enough for the zip and unzipped files to reside. Can I place the zip file in my home directory and unzip it into /var? If so, what command?

nayyares said...

SSIDJeff, yes you can do it, just use complete path of your source and destination directories. i.e.

$zcat /path/to/filename.gz > /path/to/unzipped/file

cheers

Rodolfo Barriga said...

i dont get why dont use the same idea with gunzip.. i mean

gunzip -c >

-c : keeps the original gz file.

Best