Octal dump

The od (stands for octal dump) command displays a file in octal (base 8) format by default. It is often used for visualizing data that isn’t in a human-readable format, like the executable code of a program.

For example, consider the following text file:

linux text file example

We can display this file in octal format by using the od command without any options:

linux od command

The first number on each line is an index into the file in octal. The remaining numbers represent the bytes in the file.

To display the file in hexadecimal format, use the -x option:

linux od hexadecimal

To display the file in decimal format, use the -i option:

linux od decimal

To display the file in character format, use the -c option:

linux od character

Geek University 2022