How do I Compress a Whole Linux/UNIX Folder

This is task that you will do many times when working with Linux/UNIX. This can be automated or done just as a simple one time task.

Best tool for this job is tar 

  • GNU tar  saves many files together into a single tape or disk archive, and can
    restore individual files from the archive.

GNU tar comes with many options but for my task i will use the following options only:

  • this command will create gziped archive containing the entire content of the www/ folder called www_aodba_bkp.tar.gz.

Options  used and their purpose:

  • -z Compress archive using the gzip program
  • -c  Create archive
  • -v  Verbose i.e display progress while creating archive
  • -f  Archive File name

To extract the content of a tar archive use the following command:

  • -C Extract location
  • -x Extract the content

  • this will extract to the current working directory.

  • this will extract the content into /folder directory.


GNU tar come very handy to be used on a daily basis by any system admin.

Hops this was helpful


I hope this was helpful and i appreciate if you would like, subscribe or share our posts. I it is just a click


Similar Article  Why should you learn bash programming?
No Comments
Leave a Comment

%d bloggers like this: