How do I Compress a Whole Linux or UNIX Directory?

I stored a few work files on one of my servers, which Godaddy flagged, saying it wasn’t linked to the public web, therefore I’m using it for storage.

True enough.

This is my whitehat blog, and i’m not in the mood to bite the hand that feeds atm. So time to tar.gz things up and download locally until I can figure out what to do with the files afterwards.

You need to use tar command as follows (syntax of tar command):
tar -zcvf archive-name.tar.gz directory-name
Where,

  • -z: Compress archive using gzip program
  • -c: Create archive
  • -v: Verbose i.e display progress while creating archive
  • -f: Archive File name
Example compress: tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog

Example extract: tar -zxvf prog-1-jan-2005.tar.gz

Notes: x = extract.:)

via