Create a recursive, compressed backup of a directory...
tar -czvf tarfile.tgz directory
tar -czvf tarfile.tgz 2>&1 | tee tarfile.log
Check contents of the file you have created...
tar -tzvf tarfile.tgz
Extract contents of the file you have created...
tar -xzvf tarfile.tgz
tar -xzvf tarffile.tgz 2>&1 | tee tarfile.log