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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityYou have two choices:
cd /root/Desktop/folder
tar xf /root/Documents/file.tar.gz
or
tar xf file.tar.gz -C /root/Desktop/folder
gzip -dc archive.tar.gz | tar -xf - -C /destination
?
man tar
-C, --directory DIR change to directory DIR