In Linux, how can I determine the format which was used to create a given tarball?
I'd like to detect whether a given archive was created using posix or gnu format.
I've already read the man page for GNU tar, which explains how to control the format during creation. However, I don't see anything about how to view the format of an existing file.
You can use
file
under Linux to look at the fingerprint of the uncompressed archive (file won't peer beyond the compression layer, so decompress it first):If the archive is compressed, decompress it first:
GNU is based on an older POSIX format, so that is why it says it is both.
For the nitty gritty details, the format is described in the GNU tar manual here and more details here.