Tar Cheatsheet

A quick guide to tar. spitemim.xyz/tar

by spitemim, 2021-03-24

# create an uncompressed .tar file from directory
tar -cvf files.tar /path/to/directory

# create a gzipped tarball from directory
tar -cvzf files.tar.gz /path/to/directory

# extract a gzipped tarball
tar -xvzf files.tar.gz

# extract to specific directory
tar -xvzf files.tar.gz -C /path/to/directory

# list files in archive
tar -tzf files.tar.gz

# for bzip2 compression, replace -z with -j. for xz, replace -z with -J