16

I have a certain file named tmp.gz. When I try to decompress it using gzip -d, I get an error-message that it has multiple entries:

$ gzip -d tmp.gz
gzip: tmp.gz has more than one entry -- unchanged
$ gzip -d < tmp.gz > tmp
gzip: stdin has more than one entry--rest ignored

(And I get the same errors, of course, with gunzip instead of gzip -d.)

So, how do I decompress it and get all the files?

ruakh
  • 666
  • 1
  • 5
  • 12

2 Answers2

30

As explained by 'druuna' at http://www.linuxquestions.org/questions/linux-software-2/gunzip-%5Bfile%5D-has-more-than-one-entry-unchanged-618990/#post3047709, this can happen if it's actually a ZIP-file rather than a gz-file, just with a misleading extension, and it contains multiple files. (gzip -d does support ZIP-files that contain only one file.)

In my case, that's exactly right:

$ file tmp.gz 
tmp.gz: Zip archive data, at least v2.0 to extract

and using unzip rather than gzip -d worked perfectly.

ruakh
  • 666
  • 1
  • 5
  • 12
  • 1
    Similarly, if `zcat` reports this error, instead use `unzip -c`. – Camille Goudeseune Apr 15 '19 at 20:35
  • @CamilleGoudeseune: That's an interesting suggestion, but I don't really agree. This error only happens if the Zip archive contains multiple files (since `gzip -d` / `gunzip` / `zcat` / `zless` all support single-file Zip archives just fine). So if you get this error, you can't just mechanically change your command to use `unzip`; rather, you need to take a step back and decide what you want to do now. That will surely involve `unzip` in some way, but I don't think it's helpful to try to be too precise. Typical use-cases of `zcat` are not satisfied by `unzip -c`. – ruakh Apr 15 '19 at 23:21
0
sudo unzip file.zip

Sometimes you don't have sufficient rights to unzip. Maybe write permission missing?