Scroll to navigation

HEXD(1) General Commands Manual HEXD(1)

NAME

hexdhuman-friendly hexdump tool

SYNOPSIS

hexd [-p] [-P] [-v] [-g groupsize] [-r range] [-w width] [file ...]

DESCRIPTION

hexd prints a human-readable hexdump of the specified files, or standard input if omitted. Its main distinguishing feature is the use of colours to visually indicate which range of values an octet belongs to, aiding in spotting patterns in binary data.

The ranges an octet is classified into are (0x00), (0x01..0x1F), (0x20..0x7E), (0x7F..0xFE) and (0xFF).

By default, colours are used if output is a terminal, and omitted if not.

Repeated output lines are collapsed into only one copy followed by a line with only '*', unless -v is used.

OPTIONS

If no file operands are specified, standard input is read instead. Available options are listed below.

Print usage information.
Plain: disable colours/formatting.
Pretty: enable colours/formatting.
Verbose: show every hexdump line (don't collapse repetition with '*').
groupsize
Number of octets per group, set to 8 by default.
range
Range of octets to print from each file. Specified as either or , where and / are positive integers specified in either decimal, hexadecimal or octal (C-style notation).

When the former syntax is used, both ends of the range are optional and default to the start or end of the file when omitted.

width
Number of octets per line, separated into groups (see -g). Set to 16 by default.

ENVIRONMENT

HEXD_COLORS can be used to override the formatting used by hexd to classify octets. If set, it should consist of space-separated pairs of the form , where is one of 'zero', 'low', 'printable', 'high' or 'all', and is an SGR formatting string. SGR formatting is interpreted by your terminal emulator; consult its documentation or ECMA-48 for more details.

For example, the default formatting used when HEXD_COLORS is not defined corresponds to the value

EXAMPLES

Here are some examples of useful uses of hexd's features.

Display the 512-byte range in 'foo.bin' starting at offset 0x1000. Useful when files contain other embedded files/formats at a certain location (e.g. archive files).
Show the first 16 bytes of each of the *.bin files, with a heading above each file (if more than one). This is useful for example to compare headers of several samples of an unknown format.
http://example.com | |
hexd works as a filter, too. For paging long hexdumps, less(1)'s -R flag is useful.

SEE ALSO

hexdump(1), od(1), xxd(1)

AUTHORS

Written by FireFly

February 18, 2022 Linux 5.14.21-150500.55.52-default