$ curl cheat.sh/
 cheat.sheets:tar 
# tar
# GNU version of the tar archiving utility

# An approach to backing up the current user's HOME, using tar(1) and Gzip
# compression. Permissions (modes) will be preserved. The filename format will
# be: UID:GID_DATE.tgz
#
# Replace 'DEVICE' with whichever device is applicable to you, but note that it
# must be in the '/media/USER' (where USER is the username) directory, else
# this won't work, unless you edit the formatting section of `printf`.
tar -czvpf "$(printf '/media/%s/%s/%d:%d_%(%F)T.tgz' "$USER" 'DEVICE' ${UID:-`id -u`} ${GID:-`id -g`} -1)" "$HOME"

# Delete file 'xdm' from the archive given to the `-f` flag. This only works on
# non-compressed archives, unfortunately, but those can always be uncompressed
# first, then altered with the `--delete` flag, after which you can recompress.
tar --delete -f xdm_edited.tar.gz xdm

# Extract the contents of the given archive (which is not compressed) to the
# destination given to the `-C` flag; not many seem to know of this flag.
#
# If a destination (path given to `-C`) is not provided, the CWD will be used.
tar -C /mnt -xvf Tarball.tar

 cheat:tar 
---
tags: [ compression ]
---
# To extract an uncompressed archive:
tar -xvf /path/to/foo.tar

# To create an uncompressed archive:
tar -cvf /path/to/foo.tar /path/to/foo/

# To extract a .gz archive:
tar -xzvf /path/to/foo.tgz

# To create a .gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/

# To list the content of an .gz archive:
tar -ztvf /path/to/foo.tgz

# To extract a .bz2 archive:
tar -xjvf /path/to/foo.tgz

# To create a .bz2 archive:
tar -cjvf /path/to/foo.tgz /path/to/foo/

# To extract a .tar in specified Directory:
tar -xvf /path/to/foo.tar -C /path/to/destination/

# To list the content of an .bz2 archive:
tar -jtvf /path/to/foo.tgz

# To create a .gz archive and exclude all jpg,gif,... from the tgz
tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/

# To use parallel (multi-threaded) implementation of compression algorithms:
tar -z ... -> tar -Ipigz ...
tar -j ... -> tar -Ipbzip2 ...
tar -J ... -> tar -Ipixz ...

 tldr:tar 
# tar
# Archiving utility.
# Often combined with a compression method, such as gzip or bzip.
# More information: <https://www.gnu.org/software/tar>.

# Create an archive from files:
tar cf target.tar file1 file2 file3

# Create a gzipped archive:
tar czf target.tar.gz file1 file2 file3

# Create a gzipped archive from a directory using relative paths:
tar czf target.tar.gz -C path/to/directory .

# Extract a (compressed) archive into the current directory:
tar xf source.tar[.gz|.bz2|.xz]

# Extract a (compressed) archive into the target directory:
tar xf source.tar[.gz|.bz2|.xz] -C directory

# Create a compressed archive, using archive suffix to determine the compression program:
tar caf target.tar.xz file1 file2 file3

# List the contents of a tar file:
tar tvf source.tar

# Extract files matching a pattern:
tar xf source.tar --wildcards "*.html"

# Extract a specific file without preserving the folder structure:
tar xf source.tar source.tar/path/to/extract --strip-components=depth_to_strip

$
Follow @igor_chubin cheat.sh