How to detect type of compression used on the file? (if no file extension is specified)

后端 未结 3 1091
你的背包
你的背包 2020-11-28 05:15

How can one detect the type of compression used on the file? (assuming that .zip, .gz, .xz or any other extension is not specified).

Is this information stored somew

3条回答
  •  忘掉有多难
    2020-11-28 05:36

    If you're on a Linux box just use the 'file' command.

    http://en.wikipedia.org/wiki/File_(command)

    $ mv foo.zip dink
    $ file dink
    dink: gzip compressed data, from Unix, last modified: Sat Aug  6 08:08:57 2011,
    max compression
    $
    

提交回复
热议问题