Linux commands and their modern versions
Read file
Read binary file
-
Example file:
ABCDabcd1234
Command | Usage | Example | Note |
---|---|---|---|
od | Display file contents in octal, decimal or hexadecimal format. | od --format=x1 --address-radix=x path/to/file | 000000 41 42 43 44 61 62 63 64 31 32 33 34 |
Optionally display the byte offsets and/or printable representation for each line. | |||
xxd | Create a hexadecimal representation (hexdump) from a binary file, | xxd path/to/file | 00000000: 4142 4344 6162 6364 3132 3334 ABCDabcd1234 |
or vice-versa. | |||
hexyl | A simple hex viewer for the terminal. | hexyl path/to/file | │00000000│ 41 42 43 44 61 62 63 64 ┊ 31 32 33 34 │ABCDabcd┊1234 │ |
Uses colored output to distinguish different categories of bytes. |
note
Copy & paste examples
echo ABCDabcd1234 | od --format=x1 --address-radix=x
echo ABCDabcd1234 | xxd
echo ABCDabcd1234 | hexyl
tip
The extra value of 0a
(at the end) is the ASCII code for LF (LineFeed)
, which is the newline on many systems1.