SurlyJake Blog

Tar Extract Destination Folder

| Comments

Tar can redirect extracted files to a different folder. This can be handy if you want to unpack a tar archive stored on a cd or other read-only media and want to eliminate the step of first copying the archive, extracting it, then deleting the extra tar.  All you have to do is add a ‘-C ’ to the tar command.   So here’s an example using the VMware Tools tarball:

# tar -C /root -zxvf /media/cdrom0/VMwareTools-8.3.2-257589.tar.gz

This will redirect the extracted files into the /root folder. simple