Use tar Extract files from an alternate directory

linux-penguin

When decompressing a compressed tar file, generally, the approach is to change directory to the root and execute the tar command from there with a full path to the compressed tar. There is an easier method that will remove a line or two of code from each script. Down to a single command line.

This is how to use tar to extract a compressed tar from an alternate directory rather than from where the compressed tar file resides.

tar -C / -zxvf data-20130220.tar.gz 

The -C is used to change to the directory specified directly after this option. In this case, the root directory, /.

Source(s)
man tar