hexdump − print input as hexadecimal
hexdump [−bCcdovx] [−n NUMBER] [−s NUMBER] [file ...]
hexdump [−r] [file ...]
Input files are taken as a single stream of data and formatted as hexadecimal. Standard input is used if no file arguments are provided. Duplicate lines of input are filtered by default. A '*' character is printed to indicate one or more duplicate input lines.
The following options are available:
|
−b |
One−byte octal output. |
|||
|
−C |
Output canonical hex+ASCII. Each line begins with an offset number followed by a space−separated list of 16 hex bytes. Printable input characters are listed between two '|' characters. |
|||
|
−c |
Output a space−separated list of ASCII characters. Non−print characters are listed in octal, or a C−escape code. |
|||
|
−d |
Format output as two−byte decimal. |
−n NUMBER
Terminate the process after reading a set NUMBER of input bytes. The number argument must be given in decimal. Input skipped by the −s option is not counted.
|
−o |
Format output as two−byte octal. | ||
|
−r |
Revert a hex dump back to binary. Input is expected to be formatted as canonical hex+ASCII. The initial offset address and the ASCII suffix of each line are ignored. Input lines may have zero or more hex bytes; running over 16 bytes is supported. Spaces between hex digits are ignored. An odd number of hex digits on a line results in an error. |
Setting −r causes all other options. It is possible to specify multiple input files.
−s NUMBER
Skip a set NUMBER of bytes at the beginning of input. The number argument must be given in decimal. The offset number printed on output is advanced to reflect the skipped bytes.
|
−v |
Duplicate lines of output are displayed. |
|||
|
−x |
Format output as two−byte hexadecimal. This is the default. |
No option exists for setting an output filename, so the −r option will write binary data to a terminal if output is not redirected.
Written by Michael Mikonos.
Copyright (c) 2023 Michael Mikonos.
This code is licensed under the Artistic License 2.