2

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?

warren
  • 9,920
  • 23
  • 86
  • 147

1 Answers1

4

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.

pavium
  • 6,412
  • 1
  • 27
  • 27