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

e.g.

$ 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.


Comments

2 responses to “How to tar and gzip in one step”

  1. Pat Bahan Avatar
    Pat Bahan

    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 to Krishen Cancel reply

Your email address will not be published. Required fields are marked *

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