Linux od command

Source: Internet
Author: User

Using the OD command, you can read the data file or the contents of the binary file. Although the readout value is displayed by default using a non-text file, which is a 16 binary value, we can still display bytes in the data in ASCII-type bytes through the-t C option and parameter, although for the general user, this command may not be useful, but for engineers, This command can make a rough output of the contents of a binary file, and they can see what it means.


Command format:

od [OPTION] ... [FILE] ...

Command parameters:

-T: The output of various types (type) can be followed, for example:

A: Use the default bytes to output;

C: Use ASCII bytes to output

D[size]: Use decimal to output data, each integer occupies size bytes;

F[size]: The use of floating point value (floating) to output data, each occupies a size bytes;

O[size]: Using octal (octal) to output data, each integer occupies size bytes;

X[size]: Use hexadecimal (hexadecimal) to output data, each integer occupies size bytes;


command example:

1. Use ASCII to output the contents of the/USR/BIN/PASSWD

[[email protected] ~]# od -t c /usr/bin/passwd0000000 177    E   l   f 002 001 001  \0  \0  \0   \0  \0  \0  \0  \0  \00000020 003   \0   >  \0 001  \0  \0  \0 200       \0  \0  \0  \0  \0  \00000040    @  \0  \0  \0  \0  \0  \0   \0   0   q  \0  \0  \0  \0   \0  \00000060  \0  \0  \0  \0   @   \0   8  \0  \t  \0   @  \0  034  \0  033  \0 ...... 

Note: The leftmost first column represents the number of bytes in 8. In the example above, the second column 0000020 represents the beginning of the

The content of the 16th byes (2x8).

2./etc/issue the contents of this file with an octal value and an ASCII table

[[email protected] ~]# od -t occ /etc/issue0000000 103 145 156  164 117 123 040 162 145 154 145 141 163 145 040  066          c   e   n    t   O   S       r    e   l   e   a   s   e        60000020 056 065 040 050 106 151  156 141 154 051 012 113 145 162 156 145           .   5        (    F   i   n   a   l   )   \n   k   e   r   n   e0000040 154 040  134 162 040 157 156 040 141 156 040 134 155 012  012          l       \    r       o   n        a   n       \   m   \n  \n0000057

Note: As shown above, you can find out what values each byte can correspond to!

For example, E corresponds to a record value of 145, turn into 10:1x8^2+4x8+5=101.


Learn from:

Brother Bird

This article is from the blog "Write to Yourself", so be sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1766334

Linux od command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.