Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I unzip a file from another folder?

gunzip -d /home/tomcat_dev/HN/radd/input.txt.gz 

unzips that file to the same folder. But if I want to bring it to my folder? When I do this:

gunzip -d /home/tomcat_dev/HN/radd/o.txt.gz /home/tomcat_dev/ 

it gives me a: gunzip: /home/tomcat_dev/ is a directory -- ignored

share|improve this question

migrated from stackoverflow.com Jan 25 '12 at 13:28

This question came from our site for professional and enthusiast programmers.

That's been already answered here. – jcollado Jan 23 '12 at 10:15
up vote 2 down vote accepted

It is as simple as below:

gunzip -c filepath.gz > anotherDirectoryPath

More on gunzip, also refer to the man page.

share|improve this answer


gunzip -c -d /home/tomcat_dev/HN/radd/o.txt.gz > /home/tomcat_dev/o.txt 
share|improve this answer
It works! 10x a lot – radashk RADU Jan 23 '12 at 10:18
Then you should accept the answer! ;-) – Mithrandir Jan 23 '12 at 10:20

Normally I'd use a combination of mkdir and:

gzcat /path/to/somefile.gz >/some/new/path/output
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.