Skip to content

Instantly share code, notes, and snippets.

@mondwan
Created March 15, 2015 04:55
Show Gist options
  • Save mondwan/0563f507d1439d431138 to your computer and use it in GitHub Desktop.
Save mondwan/0563f507d1439d431138 to your computer and use it in GitHub Desktop.
Archiving and compressing files in Linux
# Extract files fomr mydir.tar
tar xvf mydir.tar
# Create the archive for file mydir and compress with gzip
tar zcvf mydir.tar.gz mydir
# Create the archive for file mydir and compress with bz2
tar jcvf mydir.tar.bz2 mydir
# Create the archive for file mydir and compress with xz
tar Jcvf mydir.tar.xz mydir
# List contents for an archive
tar tvf mydir.tar.gz
# Extract file
# Do not need to specify which format you are using
tar xvf mydir.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment