Compress directory into tarball on Linux machine

From AcrodusWiki

This is the command, and more importantly the options for compressing a directory or folder into a tarball on linux.

tar -czvf filename.tar.gz /path/to/directory

Ensure that you create the tarball with touch first.

Also to unzip use the command and options.

tar -xvf /path/to/tarball

-x : extract -v : give more info -f : filename

you can also use the -C to specify output directory

tar -xvf /path/to/tarball.tar/.gz -C /path/to/directory