tar and compress cheatsheet

Deflate / Inflate / Concatenate

# Deflate / Compress
tar -czf archive.tar.gz /path/files
# Inflate / Uncompress
tar -xzf archive.tar.gz
# Concatenate files into a single tar
tar -cf archive.tar /path/files
# Extract file to a defined directory
tar -xzf archive.tar.gz -C /target/directory
# Append a file to an existing archive
tar -zu archive.tar.gz -C /target/file
#*.zip
zip -r demo.zip demo
unzip demo.zip demo
#*.tar.gz
tar -zcvf demo.tar.gz demo
tar -zxvf demo.tar.gz demo
#*.tar.bz2
tar -jcvf demo.tar.bz2 demo
tar -jxvf demo.tar.bz2 demo
#*.tar.xz
tar -Jcvf demo.tar.xz demo
tar -Jxvf demo.tar.xz demo
#*.tar.Z
tar -Zcvf demo.tar.xz demo
tar -Zxvf demo.tar.xz demo
#*.tar.lz4
tar -I lz4 -cf demo.tar.lz4 demo
tar -I lz4 -xf demo.tar.lz4 demo

Common options

zcompress with gzip
ccreate an archive
uappend files which are newer than the corresponding copy ibn the archive
ffilename of the archive
vverbose, display what is inflated or deflated
aunlike of z, determine compression based on file extension