Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to unpack a .tar.gz file to a specific directory.

The archive file is in /root/Documents. I want to unzip it into /root/Desktop/folder. The folder structure in zipped file should be preserved in the destination directory.

share|improve this question

1 Answer 1

up vote 43 down vote accepted

You have two choices:

cd /root/Desktop/folder
tar zxf /root/Documents/file.tar.gz

or

tar zxf file.tar.gz -C /root/Desktop/folder
share|improve this answer
    
thanks, how about gzip -dc archive.tar.gz | tar -xf - -C /destination ? –  alwbtc Oct 19 '11 at 13:12

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.