NAME

hexdump - print input as hexadecimal

SYNOPSIS

hexdump [-cu] [-n NUMBER] [-s NUMBER] [file ...]

hexdump [-ru] [file ...]

DESCRIPTION

Data is read from standard input if no file arguments are provided. The default output mode is canonical hex+ASCII. Each line begins with an offset number followed by a space-separated list of 16 hex bytes. Finally, printable input characters are listed between two '|' characters.

OPTIONS

The following options are available:

-c

Output a space-separated list of ASCII characters. Non-print characters are listed in octal, or a C-escape code.

-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.

-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 to be ignored except -u. 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.

-u

Output runs in unbuffered mode.

BUGS

No option exists for setting an output filename, so the -r option will write binary data to a terminal if output is not redirected.

No support for multi-byte hex display, or plain hex output.

AUTHOR

Written by Michael Mikonos.

COPYRIGHT

Copyright (c) 2023 Michael Mikonos.

This code is licensed under the Artistic License 2.