To compress a file or folder do this command:
in this example, i want to tar my web directory:

Command:
tar -pczf web.tar.gz web/



Now to untar:

Command:
tar xvfz web.tar.gz