[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 14, 2023

How to use od command in Linux.

How To Use Od Command.

The “od” is an efficient command that helps to understand the complex data which is not human-readable.

In Linux operating system, “od” is a useful command that converts the input in multiple formats with octal format by-default. As we all know, Octal has a base-8 number used to present binary numbers in a short form.

Linux developers utilize the “od” also known as Octal Dump, to debug scripts.

od Command Syntax

The fundamental syntax of the “od” command is:

od [options] .. [file_name]

 

Od Command with Examples

Before starting with the od command options, create a text file and add numeric content to understand it’s working. I’ve created a file named “test.txt” and added some data.

Let’s read this text file using the cat command in the terminal:

$ cat test.txt

 

Getting started with od Command Options

To print the “test” file content in octal format, use the “-b” option:

$ od -b test.txt

You can see the difference; test file data has been converted into the octal format.

To print “test.txt” file content in character format, use the “-c” option:

$ od -c test.txt

When you use “-An” flag with “-c” option, it will print “test.txt” file content in character format but with no offset information:

$ od -An -c test.txt

So, it is visible that when we used the “-An” flag with options, it will display output without byte offset. The “-An” flag can be used with other options as well.

Use the “-w1” flag to customize content width. For example: let’s type “-w1” with “-Ad”. It will customize the width of hexadecimal format (as -A is concatenated with d).

$ od -w1 -c -Ad test.txt

Use the “-i” option to display the result as a decimal integer:

$ od -i test.txt

Use the “-o” option to display the result as octal 2-byte units:

$ od -o test.txt

Use the “-x” option to print the result as hexadecimal 2-byte units:

$ od -x test.txt

To print help regarding the “od” command in the terminal, use the “help” command:

$ od --help

To print version information in the terminal, use the “version” option as follows:

$ od --version

 

Conclusion

Octal Dump (od) is a command in Linux used to convert file data in different formats with the octal format as default. This tutorial has shown how to use the “od” command in the terminal and its different options to convert data into various formats.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM