How do I unzip a tar gz archive to a specific destination?

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.

1 Answer

You have two choices:

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

or

tar xf file.tar.gz -C /root/Desktop/folder
7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like