johnlowvale johnlowvale - 10 months ago 43
Linux Question

Result of tar -czf

I need to put the extension for the compressed file, either .tgz or .gz. But I don't know whether this command

tar -czf somefile.XXX some/path/to/dir

makes a tarball before compression, or all files in the directory are compressed first then they are tarballed up.

Should .tgz == .tar.gz, and .gz == .zip?

Answer Source

It makes a tar archive before compression.

The suffix .tgz is a shorthand for .tar.gz, which is equivalent to first making the .tar with tar -cf somefile.tar some/path/to/dir, and then compressing that with gzip somefile.tar.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download