[LBo] question about using tar.gz for home backup
Anita Lewis
a.lewis at linuxbasics.org
Wed Sep 5 18:26:35 CEST 2007
Sam Morgan wrote:
> I had been using the line:
> tar cvzf /home /somewhere/home.tar.gz
>
> they mention using:
> tar -cf - /home | gzip -c9 > /somewhere/home.tar.gz
>
> my question is would one usage of the tar and gzip command
> be preferred over the other?
>
> also I can't find what the 9 (nine) means after the -c
> I'm guessing it may be something to indicate the amount of compression to be
> used by the gzip part of the command?
The '9' means compress best. A '1' would mean fastest. The default for
gzip is '6'. The tar manual says it uses the default for gzip; so you
would get a better compression, but slower, using 9.
The 'c' means to leave the original files unchanged. I think that will
leave your .tar file there and produce the .tar.gz as well. When you
run the first way, you do not have the .tar left, only the .tar.gz.
The first one is verbose. Looks like the second method is not verbose.
I guess it depends on what you want. Overall the best looks like the
second one, unless you want faster and don't want to keep the original
tar file. You could always put verbose on both parts of the second
method if you want that. The tar manual also explains how you can alter
a config file to get a better compression using the first method.
=======From tar manual============
The default compression parameters are used; if you need to override
them, set GZIP environment variable, e.g.:
$ GZIP=--best tar cfz archive.tar.gz subdir
=================================
Anita
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://LinuxBasics.org/pipermail/qna/attachments/20070905/30cd93f8/attachment.pgp
More information about the QnA
mailing list