Remember tar flags the easy way.

tar is one of those commands that used all the time in the terminal on bash, but it’s not easy to remember the flags or parameters for compression and extraction of .tar.gz files.

Here’s my dumb and easy to remember method for remembering the tar command options. (I don’t remember where I first came across this).

tar compression

When compressing a folder onto a .tar.gz archive, it’s as easy as telling it what you want (with an accent…).

tar create ze file”

tar -czf archive.tar.gz ./my-directory

man tar will tell you that the flags c, z and f highlighted in bold ask tar to create, compress it with gzip and finally file.

tar extraction

When extracting or uncompressing a .tar.gz archive onto a directory/file it’s as easy as telling it what you want again (with an accent…).

tar x-tract file”

tar -xf archive.tar.gz

man tar will tell you that the flags x flag here simply means extract.

Verbosity

If you want more output to know what’s happening, especially helpful with large archives, just prepend a v to the flags.

Comments & Questions

Reply by email to send in your thoughts.

Comments may be featured here unless you say otherwise. You can encrypt emails with PGP too, learn more about my email replies here.

PGP: 9ba2c5570aec2933970053e7967775cb1020ef23