Tar

Category:

Creating an archive from a directory.

tar -czvf archive.tar.gz directory/

Or just

tar czf archive.tar.gz directory


Extracting.

tar -xzvf archive.tar.gz

Or even without the file format option.

tar xf archive.tar.gz


To use bzip2 instead of gzip use j option instead of z. For bzip2 the file extension convention is “.bz2”.


List (test) the content of the archive.

tar tf archive.tar.gz