How to tar and gzip in one step

For years I have been doing this:

$ tar -cf nameOfTarFileToBeCreated directoryToBeTarred
$ gzip nameOfTarFileToBeCreated

This results in a gzip archive named nameOfTarFileToBeCreated.gz.
Last week I found a command to do it one step:

$ tar -cz directoryToBeTarGzipped > nameOfTarGzipArchiveToCreate


$ tar -cz kgreenwell > kgreenwell.tar.gz

instead of:

$ tar -cf kgreenwell.tar kgreenwell
$ gzip kgreenwell.tar

Especially handy if the tar operation is going to take a while.


  1. Sure glad you understand all this programming language. It’s all greek to me. Hope you had a great Christmas and have a Happy New Year. We did Christmas morning with Cam and Melissa and boys via web cam. My mother was blown away by the technology of today. Owen kept trying to give us kisses via the screen. So cute. Hope your trip back to the sunny south is shorter than the one I heard you had going home. Had your fix of snow for a while????

  2. Hello Mrs Bahan! Thank you for indulging me with my Greek 🙂 I saw the pics on Cam’s blog! Isn’t technology great? It’s not being there but it’s definitely an improvement from a phone call eh?
    I sure hope the trip back is shorter; 10 hours in line to talk to someone was fun but I think I’ve had my fill for the next little while 🙂
    Re: Fix of snow… no way 🙂 We’re hoping for more!
    Hope you and Mr Bahan had a great Christmas too, and happy new year 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.