Od (Unix)
Encyclopedia
od is an octal
Octal
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Numerals can be made from binary numerals by grouping consecutive binary digits into groups of three...

 dumping program for Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 and Unix-like systems. It can also dump hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...

 or decimal
Decimal
The decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations....

 data.

od is one of the earliest Unix programs, having appeared in version 1 AT&T Unix. It is also specified in the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 standards (see external link below). The implementation for od used on Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 systems is usually provided by GNU Core Utilities
GNU Core Utilities
The GNU Core Utilities or coreutils is a package of GNU software containing many of the basic tools, such as cat, ls, and rm, needed for Unix-like operating systems...

.

Example session

Normally a dump of an executable file is very long. The head
Head (Unix)
head is a program on Unix and Unix-like systems used to display the first few lines of a text file or piped data. The command syntax is: head [options] <file_name>...

 program prints out the first few lines of the output. Here is an example of a dump of the "Hello world" program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

, 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


and here is od used to diagnose the output of echo where the user types and after writing "Hello" to literal insert a tab
Tab key
Tab key on a keyboard is used to advance the cursor to the next tab stop.- Origin :The word tab derives from the word tabulate, which means "to arrange data in a tabular, or table, form"...

 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

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK