SYNOPSIS
hd [
hd [
od [
od [
xd [
xd [
DESCRIPTION
od, hd, and xd dump a file to the standard output in a format specified by command line options. The default format for od is octal words and for hd and xd is hexadecimal words. You can use combinations of options to generate multiple formats with the requested representation of each byte vertically aligned. The file seek address (in octal or hexadecimal) precedes each line of new data.
od, hd and xd
each recognize two syntaxes.
With the first form, you can specify only a single input
file.
If no file is specified, the standard input is read.
The offset operand indicates the offset, in bytes, in the file
where output should begin.
When no file is specified, then the offset must be preceded
by a plus sign (+) to distinguish it from a file name.
If the offset is followed by a period (.),
offset is considered to be a decimal number;
otherwise, it is considered to be an octal number
for od or a hexadecimal number for hd
and xd.
If the offset is followed with a b, it is multiplied by
the block size of 512 bytes.
If the
If you choose the second (POSIX-compliant) form, od, hd, and xd display the files listed on the command line one at a time. If no file appears on the command line, od hd, and xd read the standard input.
Options
The first form of od, hd, and xd accepts the following options:
-b -
bytes in octal
-c -
bytes in ASCII
-D -
unsigned decimal longs (4 bytes)
-d -
unsigned decimal words (2 bytes)
-h -
bytes in hex
-O -
unsigned octal longs
-o -
unsigned octal words
-S -
signed decimal longs
-s -
signed decimal words
-X -
unsigned hexadecimal longs
-x -
unsigned hexadecimal words
The second (POSIX-compliant) form accepts the following options:
-A addr_fmt-
specifies the format for displaying the address field. addr_fmt can be
d (decimal),o (octal),x (hexadecimal), orn (do not display address). -j num-
skips num bytes from the beginning of the file. If you precede num with 0X or 0x, it is interpreted as hexadecimal. If you precede it with 0, it is interpreted as octal; otherwise, it is assumed to be decimal. You can also append
b ,k , orm to num to indicate 512-byte blocks, kilobytes, or megabytes instead of bytes; however, if you appendb to a hexadecimal number, it is treated as the number's final hexadecimal digit. -N num-
processes a maximum of num bytes.
-t type_string-
specifies the output format. type_string may contain the following format characters.
a -
named characters from the ISO 646 character set (similar to the
-c option). c - characters. Non-printable characters are displayed as backslash sequences and display printable multibyte characters properly.
d -
signed decimal.
A one-digit number may follow
d specifying how many bytes to use. This must correspond to the size of a char, short, int, or long. The default size is the size of an int. A symbolic size character may followd , rather than the number of bytes. These have the following meaning: f -
floating point.
A one-digit number may follow
f specifying how many bytes to use. This must correspond to the size of a float, double, or long double. The default size is the size of a double. A symbolic size character may followf , rather than the number of bytes. These have the following meaning: o -
octal.
A one-digit number may follow
o specifying how many bytes to use. This must correspond to the size of a char, short, int, or long. The default size is the size of a short. A symbolic size character may followo , rather than the number of bytes. These have the following meaning: u -
unsigned decimal.
A one-digit number may follow
u specifying how many bytes to use. This must correspond to the size of a char, short, int, or long. The default size is the size of an int. A symbolic size character may followu , rather than the number of bytes. These have the following meaning: U [b |B |l |L ]-
Unicode. By default, Unicode characters are considered to be little-endian. If a byte-order marker is read, that marker is used to determine the byte order for the characters.
- Note:
-
If the
-j option skips over the byte-order marker, the marker is considered to have not been read and the byte order default defaults to little-endian.
You can force Unicode characters to be treated as big-endian by specifying
Ub orUB . Similarly, you can force them to be treated as little-endian by specifyingUl orUL .The hd, od, and xd utilities assume that Unicode characters are double-byte aligned. As a result, if you specify multiple files on the command line and one of those files has an odd number of bytes, subsequent Unicode files will not be properly double-byte aligned and will display incorrectly. Also, if a specified file is not a Unicode file, but does contain Unicode strings that are not necessarily double-byte aligned, you should use strings
-U to display those strings. x -
hexadecimal.
A one-digit number may follow
x specifying how many bytes to use. This must correspond to the size of a char, short, int, or long. The default size is the size of an int. A symbolic size character may followx , rather than the number of bytes. These have the following meaning:
Multiple format characters can appear in one type_string and multiple
-t options may appear on the command line. If there is no-t option, the default is-t oS for od and-t xS for hd and xd. -v -
displays all lines. Normally, the hd, od, and xd utilities do not display multiple lines that differ only in the address. They display the first line with a single * in it to show that any subsequent lines are the same.
DIAGNOSTICS
Possible exit status values are:
- 0
-
Successful completion.
- 1
-
Failure due to any of the following:
- 2
-
Failure due to any of the following:
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.
Only the second form of the od command line is part of the POSIX standard. The first form is an x/OPEN extension to the POSIX standard.
The hd and xd utilities, the ability
to display Unicode, the options to operate on longs (
On Windows systems, a file name consisting of a letter followed by a colon (as in C:) is operated upon by using raw disk I/O, thus allowing hd, od, and xd to examine raw disk contents.
AVAILABILITY
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Commands:
- dd
PTC MKS Toolkit 10.4 Documentation Build 39.