How to gzip a directory using the command line

Sometimes you just want to gzip up a directory. Is that so much to ask? Unfortunately I don’t do it often enough to remember which flags to use. Thus this post.

Here is how you gzip up a directory using the command line:

tar -zcvf outputFile.tar.gz sourceDirectory/

As a reminder the flags mean:

  • z – tells tar that it is dealing with gzip file
  • c – tells tar to create the archive file
  • v – verbose mode showing what files are being processed
  • f – output is a file



Be the first to comment

Leave a Reply

Your email address will not be published.


*