Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

OD Command In Unix/Linux System

Supervised By

Md. Asif Al June 


Lecturer,
Dept. of Computer Science and Engineering,
University of Barisal
OD Command in UNIX

od(Octal Dump) command in Linux/UNIX is used to


output the contents of a file in different formats with
the octal format being the default.

It displays content of a file in different human-


readable formats like hexadecimal, octal and ASCII
characters.
OD Command in UNIX
The od command writes an unambiguous
representation, using octal bytes by default, of FILE
to standard output. If more than one FILE is
specified, od concatenates them in the listed order to
form the input. With no FILE, or when FILE is a dash
("-"), od reads from standard input.

This command is especially useful when debugging


Linux scripts for unwanted changes or characters.
Syntax of od
od [OPTION]... [FILE]...

od -b <fileName> [display files in octal format]


od -t x1 <fileName> [display files in hexadecimal bytes format ]
od -c <fileName> [display files in ASCII (backslashed)
character format]
Syntax of od [1]
od -b format.txt
od -t x1 format.txt
od -c format.txt
Options in od
Format Specifications
Format Specifications
TYPE is made up of one or more of these specifications:
-b Option
It displays the contents of input in octal format.

The first column in the output of od represents the


byte offset in file.
-c Option
It displays the contents of input in character format.
-An Option
It displays the contents of input in character format
but with no offset information.
-A Option 
It Displays the byte offsets in different formats by
concatenation some special character with -A.
For example:
1. -Ax for Hexadecimal format(we concatenate x with -A)
2. -Ao for Octal format(we concatenate o with -A)
3. -Ad for Decimal format(we concatenate d with -A)
– Option
Accept input from command line.
-j Option
It displays the output after skipping some bytes.

Here, initial 4 bytes were skipped from output.


-N Option
It display limited bytes in output using -N option.

Here, initial 4 bytes were displayed from output. It


is the opposite of -j option.
-w Option 
It is used to customize the output width.

Here, initial 4 bytes were displayed from output. It


is the opposite of -j option.
-v Option
It is used to output duplicate values. As can be
observed in the output above, a * was printed. This
is done to suppress the output of lines that are
same or duplicates. But through -v option these
lines can also be printed.
-i Option
It display output as decimal integer.
 -o Option
It display output as octal 2 byte units.
 -x Option
It display output as hexadecimal 2 byte units
 -t Option
It select output format and display it.
  –help Option
It displays help information.
–version Option
It displays version information.
References
1.https://www.tutorialspoint.com/unix_commands/od.htm
2. https://www.thegeekstuff.com/2012/08/od-command/
3. https://www.computerhope.com/unix/od.htm
4. https://www.geeksforgeeks.org/od-command-linux-example/
5. https://www.javatpoint.com/linux-od

You might also like