ASCII query mode. view files in ASCII format. OD command,

Source: Internet
Author: User
Tags file separator
This article reprinted: http://www.router.net.cn/Article/36508.html
 
 
 

 

 

 

With the rapid development of computers, many people begin to learn about Linux and learn how to learn Linux commands well. To learn about Linux, you may have knowledge about the Linux Command OD. Here we will introduce the Linux Command OD application method.

Linux Command: OD

Example: OD-C hello

Linux Command: OD

Od command
Users usually use the OD command to view the content of files in special formats. You can specify different options for this command to display files in decimal, octal, hexadecimal, and ASCII code.

Syntax: OD [Option] file...
Meaning of each option in the command:
-A specifies the address base, including:
D decimal
O octal (default)
X hexadecimal
N do not print the displacement value
-T specifies the data display format. The main parameters include:
C ASCII character or backslash Sequence
D. Signed decimal number
F floating point number
O octal (the default value is 02)
U unsigned decimal number
X hexadecimal number
Other options except option C can be followed by a decimal number N, specifying the number of bytes contained in each display value.

Note: The default display mode of the OD command system is octal, which is also the origin of the command name (octal
Dump ). However, this is not the most useful display method. The combination of ASCII code and hexadecimal code can provide more valuable information output.

For example:

 
 
  1. $ OD-Ax-tcx1 WH5Note: The parameter sequence OD-Ax-txc1 WH5 reports an error.
  2. 000000 f I L E S Y S T E M
  3. 46 69 6C 65 73 79 73 74 65 6D 20 20 20 20 20
  4. 000010 1 K-B l o C K S
  5. 20 20 20 20 31 6B 2D 62 6C 6f 63 6B 73 20 20
  6. 000020 u s e d a V A I L A B
  7. 20 20 20 55 73 65 64 20 41 76 61 69 6C 61 62
  8. 000030 l e u s e % m o u n t e d
  9. 6c 65 20 55 73 65 25 20 4D 6f 75 6e 74 65 64 20
  10.  
  11. ---- My test -----
  12. Ysun @ linetcps1dev :~>Cat
  13. Hello, world.
  14. Joey.

 
 
  1. ysun@linetcps1dev:~> od -Ax -tcx4 a  
  2. 000000 h e l l o , w o r l d . /n /t J o  
  3. 6c6c6568 6f772c6f 2e646c72 6f4a090a  
  4. 000010 e y . /n /n /0 /0 /0  
  5. 0a2e7965 0000000a  
  6. 000015 

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 checking characters in files that cannot be directly displayed on the terminal.

Here document
There is a special redirection that is worth mentioning in this tutorial. Strictly speaking, the here document is a shell such as Bash.
But they provide a useful way to send special data to a text utility.
Dual-sign redirection can be used to receive the contents of pseudo files from the terminal. The here document must follow <to specify a termination separator.
For example:

 
 
  1. $ OD-C<End$ OD-C-Ax-tcx1<End: As shown above
  2. >Alice
  3. >Bob
  4. >End
  5. 0000000 a l I c E/n B o B/n
  6. 0000012

Any string can be used as a separator. The input terminates where the string itself is encountered on a line. This provides a quick way to create a persistent file:

 
 
  1. $ cat myfile <<EOF 
  2. > Dave  
  3. > Edna  
  4. > EOF  
  5. $ hexdump -C myfile  
  6. 00000000 44 61 76 65 0a 45 64 6e 61 0a |Dave.Edna.|  
  7. 0000000a 

This is the knowledge of Linux Command OD.

Edit this section to query ASCII characters: Create a text document and press and hold Alt + the code value to be queried (Note: Here it is decimal) release to display the corresponding characters. For example, if you press Alt + 97, 'A' is displayed '.

Standard ASCII table

Bin Dec HEX Abbreviations/characters Explanation
00000000 0 00 Nul (null) NULL Character
00000001 1 01 Soh (start of headling) Title start
00000010 2 02 STX (start of text) Start of Text
00000011 3 03 Etx (end of text) Text ended
00000100 4 04 EOT (end of transmission) Transfer completed
00000101 5 05 Enq (Enquiry) Request
00000110 6 06 Ack (acknowledge) Receive notification
00000111 7 07 BEL (Bell) Ring tones
00001000 8 08 BS (backspace) Return
00001001 9 09 HT (horizontal tab) Horizontal Tab
00001010 10 0a LF (NL line feed, new line) Line feed key
00001011 11 0b Vt (vertical tab) Vertical Tab
00001100 12 0c Ff (NP form feed, new page) Page feed key
00001101 13 0d Cr (carriage return) Enter key
00001110 14 0e So (shift out) No switchover
00001111 15 0f Si (shift in) Enable Switch
00010000 16 10 Dle (Data Link escape) Data Link escape
00010001 17 11 DC1 (Device Control 1) Device Control 1
00010010 18 12 DC2 (Device Control 2) Device Control 2
00010011 19 13 DC3 (Device Control 3) Device Control 3
00010100 20 14 Dc4 (Device Control 4) Device Control 4
00010101 21 15 Nak (negative acknowledge) Reject
00010110 22 16 Syn (synchronous idle) Synchronization idle
00010111 23 17 Etb (end of Trans. Block) Transfer Block ended
00011000 24 18 Can (cancel) Cancel
00011001 25 19 EM (end of medium) Media interruption
00011010 26 1a Sub (substitute) Substitutes
00011011 27 1B ESC (escape) Overflow
00011100 28 1c FS (File separator) File delimiter
00011101 29 1D GS (group separator) Group Operator
00011110 30 1e RS (record separator) Record delimiter
00011111 31 1f US (Unit separator) Unit Separator
00100000 32 20 (Space) Space
00100001 33 21 !
00100010 34 22 "
00100011 35 23 #
00100100 36 24 $
00100101 37 25 %
00100110 38 26 &
00100111 39 27 '
00101000 40 28 (
00101001 41 29 )
00101010 42 2a *
00101011 43 2b +
00101100 44 2c ,
00101101 45 2d -
00101110 46 2e .
00101111 47 2f /
00110000 48 30 0

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.