Section (1) hexdump
Name
hexdump — display file contents in hexadecimal, decimal, octal, or ascii
Synopsis
hexdump
[options]
file...
DESCRIPTION
The hexdump utility is a filter which displays the specified files, or standard input if no files are specified, in a user-specified format.
OPTIONS
Below, the length and offset arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the iB is optional, e.g. K has the same meaning as KiB), or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
−b
,−−one−byte−octal
-
One-byte octal display. Display the input offset in hexadecimal, followed by sixteen space-separated, three-column, zero-filled bytes of input data, in octal, per line.
−c
,−−one−byte−char
-
One-byte character display. Display the input offset in hexadecimal, followed by sixteen space-separated, three-column, space-filled characters of input data per line.
−C
,−−canonical
-
Canonical hex+ASCII display. Display the input offset in hexadecimal, followed by sixteen space-separated, two-column, hexadecimal bytes, followed by the same sixteen bytes in
%_p
format enclosed in _zsingle_quotesz_|
_zsingle_quotesz_ characters. −d
,−−two−bytes−decimal
-
Two-byte decimal display. Display the input offset in hexadecimal, followed by eight space-separated, five-column, zero-filled, two-byte units of input data, in unsigned decimal, per line.
−e
,−−format
format_string-
Specify a format string to be used for displaying data.
−f
,−−format−file
file
-
Specify a file that contains one or more newline-separated format strings. Empty lines and lines whose first non-blank character is a hash mark (#) are ignored.
−L
,−−color
[=when]-
Accept color units for the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled; for the current built-in default see the
−−help
output. See also the Colors subsection and theCOLORS
section below. −n
,−−length
length-
Interpret only length bytes of input.
−o
,−−two−bytes−octal
-
Two-byte octal display. Display the input offset in hexadecimal, followed by eight space-separated, six-column, zero-filled, two-byte quantities of input data, in octal, per line.
−s
,−−skip
offset-
Skip offset bytes from the beginning of the input.
−v
,−−no−squeezing
-
The
−v
option causes hexdump to display all input data. Without the−v
option, any number of groups of output lines which would be identical to the immediately preceding group of output lines (except for the input offsets), are replaced with a line comprised of a single asterisk. −x
,−−two−bytes−hex
-
Two-byte hexadecimal display. Display the input offset in hexadecimal, followed by eight space-separated, four-column, zero-filled, two-byte quantities of input data, in hexadecimal, per line.
−V, −−version
-
Display version information and exit.
−h, −−help
-
Display help text and exit.
For each input file, hexdump sequentially copies
the input to standard output, transforming the data according
to the format strings specified by the −e
and −f
options, in the order that they were
specified.
FORMATS
A format string contains any number of format units, separated by whitespace. A format unit contains up to three items: an iteration count, a byte count, and a format.
The iteration count is an optional positive integer, which defaults to one. Each format is applied iteration count times.
The byte count is an optional positive integer. If specified it defines the number of bytes to be interpreted by each iteration of the format.
If an iteration count and/or a byte count is specified, a single slash must be placed after the iteration count and/or before the byte count to disambiguate them. Any whitespace before or after the slash is ignored.
The format is required and must be surrounded by double quote ( ) marks. It is interpreted as a fprintf-style format string (see fprintf(3), with the following exceptions:
-
An asterisk (*) may not be used as a field width or precision.
-
A byte count or field precision is required for each
s
conversion character (unlike the fprintf(3) default which prints the entire string if the precision is unspecified). -
The conversion characters
h
,l,
n
,p,
andq are not supported. -
The single character escape sequences described in the C standard are supported:
NULL