1

I have a gz archive but for some reason tar said that the format is incorrect even though I can double click it in mac Finder and extract it normally, and file command shows the same format just like any other tar.gz files

Why is that and how to extract it from the terminal?

$ file archive.gz
archive.gz: gzip compressed data, original size modulo 2^32 4327594

$ tar -xzf archive.gz
tar: Error opening archive: Unrecognized archive format

$ tar --version
bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
1
  • 3
    gz is a compression format (often used to compress archives), not an archive format. Commented Feb 24, 2023 at 10:15

1 Answer 1

3

Your compressed file is probably not a Tar archive.

You can find out the uncompressed filename with gunzip -l archive.gz - that might give you a clue as to the format.

If that doesn't work, then gunzip it, and use file on the uncompressed output.

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