hd - (XENIX) display files in hexadecimal format
hd [-acbwlAxdov] [-t] [-s offset]
[-n count] [files]
The hd command displays the contents of the given files (or of
standard input if no such argument is present) in hexadecimal, decimal or
octal format, 16 bytes per line. It optionally displays printable ASCII
characters in the rightmost column. The file address is printed in the
leftmost column.
Output format selection is done with options; each format
selection option consists (optionally) of a format selector and a base
selector.
The format selectors are as follows; if no format selector is
present, the base selector is applied to all available format selectors:
- -b
- Separates the input in bytes; each byte is printed as a numerical
value.
- -c
- Separates the input in bytes; each byte that is also a printable character
is printed as such, certain characters are printed as C language escapes,
others as a numerical value.
- -w
- Separates the input in 16-bit words; each word is printed as a numerical
value.
- -l
- Separates the input in 32-bit long words; each word is printed as a
numerical value.
The following base selectors are accepted; if the base selector is
omitted, all base selectors are applied to the chosen format selectors:
- -o
- Selects octal output.
- -d
- Selects unsigned decimal output.
- -x
- Selects hexadecimal output.
The format of the addresses at the left can also be selected by
using the
- -a
- option followed by one of the base selectors; only one base selector is
applied. The default address base is hexadecimal.
The following options also affect the output format:
- -A
- Causes bytes that are printable characters to be displayed as such at the
right; nonprintable bytes are printed as `.'.
- -t
- Text file format; overrides all other format options except -a.
Each line of the input is preceded by its address; printable characters
are displayed as such, except for `\', `^', and '~', which are prefixed by
a `\' character. ASCII control characters are prefixed by `^'. Bytes with
the highest bit set that do not form a printable character are indicated
by '~', followed by the corresponding ASCII character as above.
- -v
- Unless -t is used, a set of immediately following indentical
16-byte sets is abbreviated by printing `*' for the second and further
ones. This option inhibits this behavior and causes all lines to be
displayed. This option is an extension.
If no output selection is present, the default is -bxA.
The following options affect the handling of input files:
- -s offset
- Selects a starting offset within each file. Offset is interpreted
as a decimal value unless prefixed by 0, which causes
interpretation as an octal value, or 0x, which causes
interpretation as a hexadecimal value. The suffixes w, l,
b, and k cause multiplication by 2 (`words'), 4 (`long
words'), 512 (`blocks'), or 1024 (`kilobytes'), respectively. Value and
suffix may be separated by a `*' character to suppress interpretation of
`b' as a hexadecimal digit.
- -n count
- Causes only count characters of the file to be displayed;
count is handled as the offset for -s described
above.
- LANG, LC_ALL
- See locale(7).
- LC_CTYPE
- Selects the set of printable single-byte characters for the -A and
-c options and the set of printable characters for the -t
option.