From : http://www.simplehelp.net/2008/12/15/how-to-create-and-extract-zip-tar-targz-and-tarbz2-files-in-linux/
TAR
Here’s how you compress a directory:
# tar -cvf archive_name.tar directory_to_compress
And to extract the archive:
# tar -xvf archive_name.tar.gz
This will extract the files in the archive_name.tar archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:
# tar -xvf archive_name.tar -C /tmp/extract_here/
TAR.GZ
To compress a directory use the following syntax:
# tar -zcvf archive_name.tar.gz directory_to_compress
To decompress an archive use the following syntax:
# tar -zxvf archive_name.tar.gz
Like with the tar format you can optionally extract the files to a different directory:
# tar -zxvf archive_name.tar.gz -C /tmp/extract_here/