Unix run the file in the directory

I am trying to unzip a tar file (.TGZ), but I want to unzip it into a new directory called newdir .

The command I use to unpack: tar –xzf filename.tgz

How can I deploy this to unzip it to newdir ?

+6
source share
1 answer

Add the -C option (or --directory , this is the same):

 tar –xzf filename.tgz -C /target/directory 

From man tar :

-C, --directory DIR

change directory DIR

+9
source

All Articles