Rahul Sharma (Editor)

Od (Unix)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

od is a program for displaying ("dumping") data in various human-readable output formats. The name is an acronym for "octal dump" since it defaults to printing in the octal data format. It can also display output in a variety of other formats, including hexadecimal, decimal, and ASCII. It is useful for visualizing data that is not in a human-readable format, like the executable code of a program.

od is one of the earliest Unix programs, having appeared in version 1 AT&T Unix. It is also specified in the POSIX standards. The implementation for od used on Linux systems is usually provided by GNU Core Utilities.

Since it predates the Bourne shell, 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.

Example session

Normally a dump of an executable file is very long. The head 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.

Here is an example of od used to diagnose the output of echo where the user types Ctrl+V+Ctrl+I and Ctrl+V+Ctrl+C after writing "Hello" to literal insert a tab and ^C character:

References

Od (Unix) Wikipedia