Last active
September 24, 2015 17:14
-
-
Save matheus-santos/3c3683c867dd1c034838 to your computer and use it in GitHub Desktop.
Managing tar files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar stores relative paths by default. GNU tar even says so if you try to store an absolute path: | |
# Create .tar file (with gzip) | |
tar -zcvf foo.tar /home/foo | |
# Have a look at what's in the tar file: | |
tar -tvf foo.tar | |
# Extracting file from tar file | |
tar -xvf foo.tar home/foo/bar # Note: no leading slash | |
# Simulating absolute paths | |
tar -C / -xvf foo.tar home/foo/bar # -C is the ‘change directory’ option |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment