As with many things in the *nix world, there is more than one way to generate .tar.gz files.

Typically, I use the following:

tar zcf /path/to/dir.tar.gz /path/to/dir

However, I have seen the following as well:

tar cf - <files|directories> | gzip -fq9 >/path/to/output.tar.gz

Is there a difference between the two?

If so, what is that difference, and does it "matter", or is it merely cosmetic?

link|improve this question

feedback

1 Answer

up vote 4 down vote accepted

The advantage of specifying gzip with a pipe is that you can select options, such as the speed of compression.

In the example you gave, gzip -fq9 the 9 refers to the best and slowest compression.

q means 'quiet', and f means 'force'. These options are described in the gzip man page.

link|improve this answer
never thought about that, thanks :) – warren Jul 13 '11 at 11:54
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.