Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .