Compress and unpack directory in Ubuntu using TAR

2 commands using tar in command line.

To compress using tar

.. directory www/ into tar package, use:

tar -zcf www.tar.gz www/

To unpack using tar

.. package www.tar.gz into current directory, use:

tar -zxf www.tar.gz

If you wish to specify a directory where to extract the package, you need to create the folder first and then unpack using the -C parameter

mkdir ~/package/
tar -zxf www.tar.gz -C ~/package/

You can add -v parameter to show verbose output.

Source: http://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/