home | posts | code | github | youtube | pdp11 | minipr0xy

Tar Cheatsheet

# 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