Od, hexdump, xxd --- hexadecimal viewing tool
Name: od
Location:/usr/bin/od
Permission: All Users
Purpose: view non-plain text files, such as binary files
Usage: od [-t TYPE] File
-T can be followed by outputs of various types
A: Default reason characters are output.
C: output using ASCII characters
D [size]: output data in decimal format. Each integer occupies size bytes.
F [size]: outputs data using floating point numbers. Each integer occupies size bytes.
O [size]: Outputs Data Using octal. Each integer occupies size bytes.
X [size]: The hexadecimal format is used to output data. Each integer occupies size bytes.
For example:
# Od-t c/etc/issue
0000000 C e n t o s r e l e a s e 6
0000020. 7 (F I n a l) \ n K e r n e
0000040 l \ r o n a n \ m \ n
0000057
# Od-t d/etc/issue
0000000 1953391939 1914721103 1634036837 908092787
0000020 673199918 1634625862 1258957164 1701737061
0000040 1918640236 544108320 1545629281 658029
0000057
Hexdump testfile
For more information, see the help documentation.
Xxd
First open in binary mode:
Vim-B filename
In vim command mode, enter:
: %! Xxd # parameter % refers to the file currently edited
After editing, we need to restore it to a binary file:
: %! Xxd-r # parameter-r refers to converting the current hexadecimal format to binary