I was recently looking for the best way to back up a folder to a tar.gz archive and came across this command.

tar -cvpzf backup.tar.gz foldername

Replace backup.tar.gz with the name of the file you want to create, and replace foldername with the name of the folder you are backing up. For example to back up the /var/www/ folder

tar -cvpzf backup.tar.gz /var/www/

Done :)