Conver binary to hex and reverse with xxd 

Joined:
01/15/2009
Posts:
86

May 20, 2011 13:46:04    Last update: May 20, 2011 13:46:04
The Unix utility can convert a binary stream to hex and reverse it. The -p (or -ps) switch means "plain", or "postscript" mode.

$ cat >test.txt
Line one
Line two
Line three

$ xxd test.txt
0000000: 4c69 6e65 206f 6e65 0a4c 696e 6520 7477  Line one.Line tw
0000010: 6f0a 4c69 6e65 2074 6872 6565 0a0a       o.Line three..

$ xxd -p test.txt
4c696e65206f6e650a4c696e652074776f0a4c696e652074687265650a0a

$ xxd -ps test.txt
4c696e65206f6e650a4c696e652074776f0a4c696e652074687265650a0a

$ xxd -p test.txt | xxd -r -p
Line one
Line two
Line three
Share |
| Comment  | Tags