Linux--XXD (EXT)

Source: Internet
Author: User

Linux XXD commands

xxd [Options] [infile [outfile]]
Xxd-r[evert] [options] [infile [outfile]]

The XXD command is used to display the contents of a file in binary or hexadecimal order, if the outfile parameter is not specified, the result is displayed on the screen, if outfile is specified, the result is output to outfile, if the infile parameter is-or no infile parameter is specified, The default is read in from standard input.

Common options:

- b

Go to bit (binary number) mode instead of hexadecimal mode. In this mode, each character is represented as a eight-0/1 number, rather than a generic 16-binary form. Each row is preceded by a line number in the form of 16, followed by the form ASCII (or EBCDIC). Command-line option-r,-P does not work in this mode.

-H

Exit after displaying the help information.

- L N

Only N characters are output.

-ps

Sequential hexadecimal dump output in PostScript, which is also known as a pure hexadecimal dump.

- R

Reverse: Converts the hexadecimal output of xxd back to the binary contents of the original file.

-seek Offset

After-R: The offset of the current file is increased.

- s [+][-]seek

Start with an absolute or relative offset from the infile. + indicates the current position relative to the label input (no meaning if no standard input). – From the end of the file (if and +: from the standard input current position) number of characters forward, starting from that place. If you do not have the-s option, Xxd starts at the current position.

- u

The hexadecimal output uses uppercase letters, which are lowercase by default.

Usage Example: (from Xxd man page)

Displays all the contents of file except for the first three rows (16 0x30).

$ xxd-s 0x30 file

Displays all the contents of the last three rows of file (16 0x30).

$ xxd-s -0x30 file

Display 120 characters, 20 characters per line, continuous display.

$ xxd-l 120-ps-c Xxd.1
2e544820585844203120224d616e75616c207061
676520666f7220787864220a2e5c220a2e5c2220
32317374204d617920313939360a2e5c22204d61
6e207061676520617574686f723a0a2e5c222020
2020546f6e79204e7567656e74203c746f6e7940
7363746e7567656e2e7070702e67752e6564752e

Displays 120 characters, 12 characters per line.

$ xxd-l 120-c Xxd.1
0000000:2e54 4820 5858 4420 3120 224d. TH XXD 1 "M
000000c:616e 7561 6c20 7061 6765 2066 anual page F
0000018:6f72 2078 7864 220a 2e5c 220a or Xxd ". \”.
0000024:2E5C 2220 3231 7374 204d 6179. \ "21st May
0000030:2031 3939 360a 2e5c 2220 4d61 1996..\ "Ma
000003c:6e20 7061 6765 2061 7574 686f N page autho
0000048:723a 0a2e 5C22 2020 2020 546f r:.. \ "to
0000054:6e79 204e 7567 656e 7420 3c74 ny Nugent
0000060:6f6e 7940 7363 746e 7567 656e [email protected]
000006c:2e70 7070 2e67 752e 6564 752e. ppp.gu.edu.

Displays only the dates in the Xxd.1.

$ xxd-s 0x28-l 12-c Xxd.1
0000028:3231 7374 204d 6179 2031 3939 21st May 199

Take Input_file to output_file and add 100 bytes of 0x00 in front.

$ Xxd input_file | xxd-r-s > Output_file

Give the date of the Eucalyptus Xxd.1 the nail.

$ echo ' 0000029:3,574 68′| Xxd-r–xxd.1
$ xxd-s 0x28-l 12-c Xxd.1
0000028:3235 7468 204d 6179 2031 3939 25th May 199

Create a 65537-byte file, all bytes are 0x00, except the last byte is ' a ' (hex 0x41).

$ echo ' 010000:41′| xxd-r > file

Open the Autoskip, showing the file created in the previous example.

$ xxd-a-C file
0000000:0000 0000 0000 0000 0000 0000 ......
*
000fffc:0000 0000 .... A

Create a file that contains only a ' a '. The number behind '-r-s ' is offset from the line number in the file's Eucalyptus; The result is that the beginning byte is skipped.

$ echo ' 010000:41′| xxd-r-s-0x10000 > File

Separate characters are read from the serial line.

$ xxd-c1 </dev/term/b &
$ Stty </dev/term/b-echo-opost-isig-icanon min 1
$ echo-n foo >/dev/term/b

Transfer from Http://zhan.renren.com/program?gid=3602888498030132574&checked=true

Linux--XXD (EXT)

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.