[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
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 Exclude Files and Directories with Rsync
March 22, 2023

How to Exclude Files and Directories with Rsync

How To Exclude Files And Directories With Rsync In this tutorial, we will show you how to exclude files and directories with rsync. With Rsync you can mirror data, create incremental backups and files between systems. When ing data, you may want to exclude one or more files or directories based on…

Read article
How to Transfer Files with Rsync over SSH
March 22, 2023

How to Transfer Files with Rsync over SSH

How To Transfer Files With Rsync Over SSH In this tutorial, we will explain how to files with rsync over SSH. When it comes to transferring files between systems on the network, Linux and Unix users have a lot of tools at their disposal. The most popular protocols for data transfer are SSH and FTP…

Read article
How to Check Linux Version.
March 21, 2023

How to Check Linux Version.

How To Check Linux Version. This article shows how to check what Linux distribution and version is installed on your system using the command line. Some of the most popular Linux distributions are Debian, Red Hat, Ubuntu, Arch Linux, Fedora, CentOS, Kali Linux, OpenSUSE, Linux Mint, etc. A Linux…

Read article
Get in Touch

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

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

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00