od
is a
command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on Apple Macintosh computer keyboards
...
on various
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s for displaying ("dumping") data in various
human-readable output formats. The name is an acronym for "
octal
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
dump" since it defaults to printing in the
octal
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
data format.
Overview
The
od
program can display output in a variety of formats, including
octal
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
,
hexadecimal
In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, h ...
,
decimal, and
ASCII
ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
. It is useful for visualizing data that is not in a human-readable format, like the
executable
In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data fil ...
code of a program, or where the primary form is ambiguous (e.g. some Latin, Greek and Cyrillic characters looking similar).
od
is one of the earliest
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
programs, having appeared in version 1
AT&T Unix. It is also specified in the
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming inte ...
standards. The implementation for
od
used on
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
systems is usually provided by
GNU Core Utilities.
Since it predates the
Bourne shell
The Bourne shell (sh) is a shell command-line interpreter for computer operating systems.
The Bourne shell was the default shell for Version 7 Unix. Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link ...
, its existence causes an inconsistency in the
do
loop syntax. Other loops and logical blocks are opened by the name, and closed by the reversed name, e.g.
if ... fi
and
case ... esac
, but
od
's existence necessitates
do ... done
.
The command is available as a separate package for
Microsoft Windows as part of the
UnxUtils collection of
native Win32 ports of common GNU Unix-like utilities. The command has also been ported to the
IBM i operating system.
Example session
Normally a dump of an executable file is very long. The
head
A head is the part of an organism which usually includes the ears, brain, forehead, cheeks, chin, eyes, nose, and mouth, each of which aid in various sensory functions such as sight, hearing, smell, and taste. Some very simple animals may no ...
program prints out the first few lines of the output. Here is an example of a dump of the
"Hello world" program,
piped through head.
% od hello , head
0000000 042577 043114 000401 000001 000000 000000 000000 000000
0000020 000002 000003 000001 000000 101400 004004 000064 000000
0000040 003610 000000 000000 000000 000064 000040 000006 000050
0000060 000033 000030 000006 000000 000064 000000 100064 004004
0000100 100064 004004 000300 000000 000300 000000 000005 000000
0000120 000004 000000 000003 000000 000364 000000 100364 004004
0000140 100364 004004 000023 000000 000023 000000 000004 000000
0000160 000001 000000 000001 000000 000000 000000 100000 004004
0000200 100000 004004 002121 000000 002121 000000 000005 000000
0000220 010000 000000 000001 000000 002124 000000 112124 004004
Here is an example of
od
used to diagnose the output of
echo
In audio signal processing and acoustics, an echo is a reflection of sound that arrives at the listener with a delay after the direct sound. The delay is directly proportional to the distance of the reflecting surface from the source and the li ...
where the user types and after writing "Hello" to literal insert a
tab and
^C
character:
% echo "Hello ^C" , od -cb
0000000 H e l l o \t 003 \n
110 145 154 154 157 011 003 012
0000010
See also
*
Hex editor
*
Hex dump
In computing, a hex dump is a hexadecimal view (on screen or paper) of computer data, from memory or from a computer file or storage device. Looking at a hex dump of data is usually done in the context of either debugging, reverse engineering or ...
References
External links
*
od - GNU Core Utilities manpage
{{Core Utilities commands
Unix SUS2008 utilities
IBM i Qshell commands