Terminal Dojo
Help العربية Sign inGet started

Command library / tar

tar

BashDraft — pending expert review3 practice missions

Create or extract archive files

Bundles many files into one archive, or unpacks one. The classic combo is c+z+v+f (create, gzip-compress, verbose, filename) to make a .tar.gz, and x+z+v+f to unpack one. The letters can be bundled after a single dash, and whichever position 'f' ends up in, the archive filename comes right after it.

Practice tar

Usage

tar -czvf archive.tar.gz files...
tar -xzvf archive.tar.gz
tar -tzvf archive.tar.gz

Options and flags

Examples

Common mistakes

tar -xzvf tar -xzvf backup.tar.gz

-f needs the archive's file name right after it — tar has nothing to extract from without one.

Related commands

cp