Archiving consists of two steps:
- Combine many files into a single file
- optionally apply compression
With a tar.gz
file, these layers of archiving are created by first combining the files and their Metadata into a tape archive, then gzipping this single file.
So two different programs (tar and gzip) are used to create the .tar.gz
file, both of which can be used alone:
- Just gzip: Think of archived log files (eg
syslog.2.gz
)
- Just tar: Think of backup to a tape drive with built-in compression
When such a file is unpacked on linux via tar -xz
you explicitly start both programs: tar
is called and the -z
option tells it to pipe through gzip -d
(or friends like zcat, ...)
On Windows, when you just open the file, the decompression program has no way of knowing, if you just want to decompress the tar
file or decompress it and unpack it. So it does the safe thing and decompresses only, allowing you to unpack later.