EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Linux OD

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Linux Tutorial » Linux OD

Linux OD

Introduction to Linux OD

The Linux od command is using to convert the content of the input data or file into different formats like hexadecimal, decimal, signed decimal, unsigned decimal, octal. The default conversation of od command is octal. The Linux od command is especially useful to fix or identify the unwanted changes or characters in the bash/shell scripts or programs. If we are providing one or more inputs files to od command. The od command will concatenate them in the list order from the input. As per the requirement, the output will display in a different format. The Linux od command is written by Jim Meyering.

Syntax

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

od [ OPTION ][ FILE ]

  • OPTION: as per the requirement we can provide the different option in od command
  • FILE: it is the input data or file

How Linux OD Command works?

The Linux OD command is normally used to convert the exiting output into a different format. The od tool gets the input from the input file and converts the actual data of the input file as per the give option in od command. The output of od command may vary as per the option used in the same command.

Examples to Implement Linux OD Command

Here are some examples mentioned:

Examples #1

OD Command for Octal Format: This is the most basic and simple use of od command. We can get the output data in octal format. “-b” option will be used in the od command.

Code:

od –b od.txt

Output:

Octal Format

Linux od2

Explanation: We are having a sample directory. In the same directory, we have an “od.txt” file with some sample data (refer screenshot 1 (a)). In od command, we are using the “-b” option to get the output result in octal format. It is simply converting the input data file in default octal format. You will get the output data in a converted format (refer screenshot 1 (b)).

Examples #2

OD Command for Character Format: In od command, we are having the functionality to get the input data in character format. We need to use the “-c” option in the od command.

Code:

od –c od.txt

Output:

Character Format

Linux od4

Explanation: In the “od.txt” file, we are having the text data in it (refer screenshot 2 (a)). As per the above command, we are using the “-c” option to convert the input data into character format (refer screenshot 2 (b)).

Popular Course in this category
Kali Linux Training (3 Courses, 3+ Projects)3 Online Courses | 3 Hands-on Projects | 21+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (5,494 ratings)
Course Price

View Course

Related Courses
Linux Training Program (16 Courses, 3+ Projects)Red Hat Linux Training Program (4 Courses, 1+ Projects)

Examples #3

OD Command with Offset Details: In od command, we are having the functionality to remove the offset values or offset information from the output data. To remove the offset information we can use the “-An” option in the od command.

Code:

od -An -b od.txt

Output:

Offset Details

Linux od6

Explanation: When we are converting the normal input data or file from one format to another format. As per the default standard, the offset values are attached to the output. But if we are having the big file then it is important to remove the offset value to get the short format of output data. In the above od command, we are having the input file “od.txt”. It is contacting the normal text data. After converting into the octal format the output data is coming with offset value (refer screenshot 3 (a)). Now we are using the “-An” option in od command to remove the offset value form the output (refer screenshot 3 (b)).

Example #4

OD Command with Concatenation: In od command, we can display the output in concatenation format with different values. With the help of the “-A” option, we can add or concatenate different values.

Code:

od -Ao -c od.txt
od -Ax -c od.txt
od -Ad -c od.txt

Output:

Concatenation

Linux od8

Linux od9

Explanation: As per the above command, we can display the output in different concatenate format. We will get the output in hexadecimal format with concatenating “o” with –A (refer screenshot 4 (a)). Similarly, we will get the output in hexadecimal format with concatenating “x” with –A (refer screenshot 4 (b) likewise concatenate “d” with –A (refer screenshot 4 (c)).

Example #5

OD Command with User Input: In od command, we are having the functionality to take the live user input to od command and the command will display the output data before pressing ctrl+d.

Code:

od -b -

Output:

User Input

Explanation: Sometimes we need a live interpreter to interpret the user data and convert it at the same movement. The od command is providing the same facility. In the above command, we are providing the input data as “Hello EDUCBA”. The od command will get the input data and convert it into the octal format.

Example #6

OD Command with Limited Bytes: In od command, we can display the limited bytes in output. We can use “-N” to display the limited bytes.

Code:

od -N5 -c od.txt

Output:

Limited Bytes

Linux od12

Explanation: In screenshot 5 (a), we are getting the output in character format. But now we do not display the complete output. we need an output in a limited format. Hence we are using the “-N” option with the number of characters to display (refer screenshot 5 (b)).

Example #7

OD Command with Width Option: As per the requirement, we can customize the output data width.

Code:

od -w5 -c -Ad od.txt

Output:

Width Option

data width

Explanation: In screenshot 6 (a), we will get the default width size of the output display. If we need to changes the output display width size. We can do that in od command using the “-w” option. With the “-w” option we need to specify the width size (refer screenshot 6 (b)).

Conclusion

We have seen the uncut concept of “Linux OD Command” with the proper example, explanation and command with different outputs. The od command is useful to convert the input data into a different format. It is mainly useful for visualizing output data that is not in a human-readable format. It will like the program or executable code.

Recommended Articles

This is a guide to Linux OD. Here we discuss an introduction to Linux OD, syntax, how does it work, examples with code, output and explanation. You can also go through our other related articles to learn more –

  1. Copy Command in Linux
  2. PS command in Linux
  3. Linux tac
  4. Linux rm Command

All in One Software Development Bundle (600+ Courses, 50+ projects)

600+ Online Courses

50+ projects

3000+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Linux Tutorial
  • Linux Commands
    • CAT Command in Linux
    • PS command in Linux
    • Mkdir Command in Linux
    • rmdir command in Linux
    • mv command in Linux
    • Linux rm Command
    • CHMOD Command in Linux
    • Zip Command in Linux
    • Linux Route Command
    • SCP Command in Linux
    • du Command in Linux
    • Less Command in Linux
    • Copy Command in Linux
    • Head Command in Linux
    • Help Command in Linux
    • Linux History Command
    • hostname Command in Linux
    • GREP Command in Linux
    • Linux Curl Command
    • Linux List Users
    • Linux List Directories
    • Linux Directory Permissions
    • Find Directory Linux
    • Linux User Permission
    • Linux Add User
    • Linux Delete User
    • Linux uniq
    • Linux Filter Commands
    • Linux sort Command
    • Linux Sort by Size
    • Remove dir Linux
    • Linux tr Command
    • Linux Touch Command
    • Linux More Command
    • Linux Cal Command
    • Linux OD
    • Linux Zcat
    • Linux tracepath
    • Linux Sleep
    • Linux bg Command
    • Linux WC
    • Linux Read
    • Linux Write
    • Linux Rename Command
    • Linux Free Command
    • Linux tac
    • Linux Shred
    • Linux wget
    • Linux Date
    • Linux Untar
    • Linux JQ
    • Linux Xargs
    • Linux Mount Command
    • Linux mdadm
    • Linux comm
    • Linux tee Command
    • Tail Command in Linux
    • Linux gzip
    • Linux Directory Structure
    • Linux Alias Command
    • Linux Inode
    • Linux Ping
    • Linux Watch Command
    • Linux Split Command
    • Linux Size
    • Linux Network Stack
    • Linux Diff Command
    • Vim Command in Linux
    • Linux nslookup
  • Basic
    • Introduction to Linux
    • What is Linux
    • Careers in Linux
    • How to Install Linux
    • How to Install Ubuntu
    • How to Install Ubuntu Server
    • How To Install Debian
    • Advantage Of Linux
    • What is Raid in Linux
    • What is Raid 5?
    • Raid 5 vs Raid 6
    • Careers in Linux Administration
    • What is Shell in Linux?
    • Bash Shell in Linux
    • Linux Emulator
    • Linux Operators
    • Linux Apps
    • Linux Keyboard Shortcuts
    • Linux Crontab
    • What is Raid Storage
    • What is Vmware
    • What is RedHat
    • What is Debian
    • Uses of Ubuntu
    • Career In RedHat
    • Linux Distributions
    • Linux From Scratch
    • Linux Format
    • Cheat Sheet Linux
  • Advanced
    • Install VMware
    • Install GRUB
    • Chown Command in Linux
    • Linux Network Command
    • Configuring Linux Network Environment
    • DNS Configuration in Linux
    • Linux Users
    • Create User in Linux
    • DHCP Server in Linux
    • FTP Server in Linux
    • Linux Regular Expression
    • IP Command in Linux
    • Set IP Address in Linux
    • Tar Command in Linux
    • Dynamic Host Configuration Protocol
    • Linux Kill Signals
    • Linux File Permissions
    • Linux File System
    • Linux Create File
    • Linux Concatenate Files
    • Linux Join
    • Linux Process Management
    • Linux Proxy Server
    • Linux System Commands
    • Linux System Logging
    • NFS in Linux
    • Linux LVM
    • Linux Repository
    • Samba Server in Linux
    • Top Commands in Linux
    • Types of Shells in Linux
    • Shell Script Types For Linux
    • GCC Command in Linux
    • Monolithic Kernel
    • YARN Package Manager
    • Linux Sed Replace
    • Linux List Groups
    • Linux Container
    • Linux Find File by Name
    • Create Folder in Linux
    • Linux Move Folder
    • Linux Error Codes
    • Linux Automount
    • Linux HugePages
  • Kali Linux
    • Install Kali Linux
    • Kali Linux Uses
    • Kali Linux Commands
    • Kali Linux Repository
    • Kali Linux Packages
    • Kali Linux root password
    • Kali Linux Alternative
  • Interview Questions
    • Linux Interview Questions
    • Linux System Administration Interview
    • Red Hat Interview Questions

Related Courses

Kali Linux Training

Linux Training Course

Red Hat Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Kali Linux Training Learn More