1

I'm doing a backup scheme wherein we create an uncompressed .tar file, add any new or changed files to it for a week or two. Now, at the end of this, is there an easy way to add compression to the .tar file so that we can start a new one?

Or do I just have to run a separate gzip command or similar?

Thanks in advance!

6
  • 1
    do following man gzip!
    – alexus
    Mar 2 '17 at 16:58
  • Thanks for the downvotes guys. I DID do research, and read thru the man, and there was no indication if this was possible..
    – Bruce
    Mar 2 '17 at 20:27
  • are you saying man gzip doesn't cover how to gzip? seriously?
    – alexus
    Mar 2 '17 at 20:29
  • i didn't ASK about gzip, i asked about TAR functionality. as in, if you'll read the actual question, can I use the TAR command to add compression to the TAR file after it's been created.
    – Bruce
    Mar 2 '17 at 20:33
  • if you would man tar you'd see tar doesn't offer compression, tar originally was made for tapes, gzip can compress files such as .tar
    – alexus
    Mar 2 '17 at 20:34
3

Why not adding compressed files directly? Anyway, tar can't compress single files later on, but just doing a gzip file.tar will have essentially the same effect... mv before, if you want to reuse the same file name for the next iteration right away...

1
  • If you mean why not create the tar originally with compression, it's because we want to be able to add/update it. According to the man, you can't do that with a compressed tar. So yeah, I'll have to just gzip it after Thanks!
    – Bruce
    Mar 2 '17 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy