The following tar command will:
-c: create a new archive-z: gzip-f: use archive file-v: verbose - list all files archived (optional)
tar -czvf [FILENAME].tar.gz [DIRECTORY]The following extra parameters are useful:
-p: preserve permission--exclude: exclude files
Compress directory with exclude file extension.
tar -czvf [FILENAME].tar.gz [DIRECTORY] --exclude "*.pyc"Compress directory with exclude sub directory.
tar -czvf [FILENAME].tar.gz [DIRECTORY] --exclude "tmp"Compress directory with multiple excludes.
tar -czvf [FILENAME].tar.gz [DIRECTORY] --exclude "*.pyc" --exclude "tmp"Extract .tar.gz.
tar -zxf [FILENAME].tar.gz