Hexdump

From LinuxIntro
Jump to: navigation, search

hexdump is a command that allows you to view the content of a file as well as text as in hexadecimal numbers. It is useful if you want to analyze magic numbers of file formats, check for unicode flavor or see if your file really contains what it pretends to contain.

Example
hexdump -C /mnt/loop/dcim/100kv550/100_0005.mov
00000000  00 00 01 18 73 6b 69 70  20 01 00 00 7a dc 00 00  |....skip ...z...|
00000010  d5 07 01 05 0b 30 08 00  00 00 00 00 4f 79 00 00  |.....0......Oy..|
00000020  9a 03 1e 00 80 02 e0 01  00 00 80 00 00 00 80 00  |................|
00000030  18 00 4b 00 18 00 00 00  10 00 00 00 00 00 80 3e  |..K............>|
00000040  08 00 00 00 10 00 00 00  08 00 00 00 00 00 01 00  |................|
00000050  00 01 00 00 00 00 01 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 00 00 01 00  00 00 00 00 00 00 00 00  |................|
00000070  00 00 00 00 00 00 00 40  40 00 80 00 80 00 80 00  |.......@@.......|
00000080  00 00 00 00 02 00 00 00  01 00 00 00 01 00 00 00  |................|
00000090  01 00 00 00 00 01 45 41  53 54 4d 41 4e 20 4b 4f  |......EASTMAN KO|
[...]

You see the file starts with the bytes 00 00 01 18 (hexadecimal). This could be the magic number of the mov file.