Create / Extract .tar.gz files

Categories:

To create a tar.gz archive from a given folder you can use the following command

tar -zcvf tar-archive-name.tar.gz source-folder-name

This will compress the contents of source-folder-name to a tar.gz archive named tar-archive-name.tar.gz

To extract a tar.gz compressed archive you can use the following command

tar -zxvf tar-archive-name.tar.gz

to compress a directory with saved permissions:

tar -pczf archive.tar.gz folder