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.

link|improve this question

feedback

1 Answer

up vote 4 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
link|improve this answer
thanks, how about gzip -dc archive.tar.gz | tar -xf - -C /destination ? – alwbtc Oct 19 '11 at 13:12
feedback

Your Answer

 
or
required, but never shown

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