How can I view file header information?

10,795

you can use some command that read the hexadecimal of a file like hexdump and then read the header from the right panel example:

hexdump -C  Desktop/somefile | head

The output is:

00000000  ff d8 ff e0 00 10 4a 46  49 46 00 01 01 00 00 01  |......JFIF......|
00000010  00 01 00 00 ff fe 00 3b  43 52 45 41 54 4f 52 3a  |.......;CREATOR:|
00000020  20 67 64 2d 6a 70 65 67  20 76 31 2e 30 20 28 75  | gd-jpeg v1.0 (u|
00000030  73 69 6e 67 20 49 4a 47  20 4a 50 45 47 20 76 38  |sing IJG JPEG v8|
00000040  30 29 2c 20 71 75 61 6c  69 74 79 20 3d 20 39 30  |0), quality = 90|
00000050  0a ff db 00 43 00 03 02  02 03 02 02 03 03 03 03  |....C...........|
00000060  04 03 03 04 05 08 05 05  04 04 05 0a 07 07 06 08  |................|
00000070  0c 0a 0c 0c 0b 0a 0b 0b  0d 0e 12 10 0d 0e 11 0e  |................|
00000080  0b 0b 10 16 10 11 13 14  15 15 15 0c 0f 17 18 16  |................|
00000090  14 18 12 14 15 14 ff db  00 43 01 03 04 04 05 04  |.........C......|

as you see this show me that this file is a jpeg image.

Another option is xxd

xxd Desktop/somefile | head

gives same output of above.

Share:
10,795

Related videos on Youtube

Parto
Author by

Parto

Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows neither victory nor defeat. ― Theodore Roosevelt

Updated on September 18, 2022

Comments

  • Parto
    Parto over 1 year

    I looked at this question Mark PDF as Adobe PDF and one of the answers says:

    In my document headers created with LibreOffice, the version 1.4 is having fewer header information.

    What header information is this and how can I view it? For all type of files if possible.

  • Parto
    Parto about 10 years
    Is this the same as mime type?
  • Maythux
    Maythux about 10 years
    @AvatarParto yes
  • Parto
    Parto about 10 years
    But this seems to have more info than a mime type
  • Maythux
    Maythux about 10 years
    it looks like with more information please check this for more information freeformatter.com/mime-types-list.html
  • Parto
    Parto about 10 years
    The mime type for a JPG is just 'image/jpeg'. The header file includes the creator and quality too. And I'm sure this info changes depending on the type of file.
  • Maythux
    Maythux about 10 years
    In the header all information about a file is found including the mime type, file size, and other metadata.. with more examples you may see the dates(creation/modification), and many other metadata. Those metadata are much useful in case of data recovery.. But in my answer i was just strict to reply your narrow needs. But in few words, header of a file will show you all available metadata
  • Maythux
    Maythux about 10 years
    @AvatarParto you are welcome Buddy. I'm glad to serve you