0

I see all Windows archive programs first list one tar file in tar.gz, not compressed files contained within.

So I double click the tar file and the program extracts the tar in a temporary folder and then list the files.

But in Linux I can easily list files inside tar.gz. I can't find any evidence if tar extracts the archive temporarily. Am I correct? If so, why don't they do like in Linux?

1 Answer 1

1

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.

2
  • Yeah, I know how a tar.gz file is made, but again, for example, tar tzf ... lists files with no time. Why don't Windows arcivers do like that with whatever techniques like piping through or as such.
    – DylanYi
    Commented Jun 4, 2020 at 0:39
  • @DylanYi As I said: With the tar -xz command you explicitly ask for decompression and unpacking. WIth a doubleclick you don't have that liberty, so the application doesn't know if you want decompression only or both. It does the safe thing. Commented Jun 4, 2020 at 8:12

You must log in to answer this question.

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