Linux OD command

Source: Internet
Author: User

Linux directive: OD

Example usage: od-c Hello

Linux directive: OD

OD command
Users typically use the OD command to view file content in a special format. You can display files in decimal, octal, hexadecimal, and ASCII codes by specifying different options for the command.

Syntax: OD [options] File ...
Meaning of the options in the command:
-A Specifies the address base, including:
D Decimal
o Octal (System default)
X hex
n Do not print displacement values
-t specifies the display format of the data, the main parameters are:
C ASCII character or backslash sequence
D Signed Decimal number
F Floating point number
o Octal (system default is 02)
U unsigned decimal number
x hexadecimal number
In addition to option C, you can follow a decimal number n to specify the number of bytes that each display value contains.

Description: The OD command system is displayed by default in octal, which is also the name of the command (octal
Dump). But this is not the most useful way to display, the combination of ASCII and hexadecimal can provide more valuable information output.

For example:

 
   
  
  1. $ od-ax-tcx1 wh5 
  2. 000000 F i l e s y S t e m 
  3. 6c 65 73 79 73 6d 20 
  4. 000010 1 k-b l o C k s 
  5. (6b) 2d + 6c 6f 6b 20 
  6. 000020 U S e d a v a i l A b 
  7. All-in-all 6c 62 
  8. 000030 l e u s e% M o u n T e d 
  9. 6c 4d 6f 74 6e 65 64 20  
  10.  
  11. ----My Test----- 
  12. [email protected]:~ ; CA T a 
  13. hello,world. 
  14. joey. 
 
   
  
  1. [Email protected]:~>

OD and Hexdump
The utility OD and hexdump output the octal, hexadecimal, or other encoded bytes of the file or stream, respectively. They are useful for accessing or visually inspecting characters in a file that cannot be displayed directly on the terminal.

Here documentation
There is a special redirect worth mentioning in this tutorial. While strictly speaking, here documentation is a shell like bash
, not anything related to the text utility, but they provide a useful way to send special data to a text utility.
Double less than sign redirection can be used to receive the contents of a pseudo-file from a terminal. The here document must be immediately followed by a terminating delimiter in <<.
Such as:

 
   
  
  1. <<end
  2. >
  3. >
  4. >

Any string can be used as a delimiter, and the input terminates where the string itself is encountered on a single line. This gives us a quick way to create a persistent file:

 
   
  
  1. <<eof
  2. >
  3. >
  4. >

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.