Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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