Hexdump reverse command

Maysara Alhindi picture Maysara Alhindi · May 1, 2017 · Viewed 21.5k times · Source

The hexdump command converts any file to hex values.

But what if I have hex values and I want to reverse the process, is this possible?

Answer

Bert picture Bert · May 1, 2017

There is a similar tool called xxd. If you run xxd with just a file name it dumps the data in a fairly standard hex dump format:

# xxd bdata
0000000: 0001 0203 0405
......

Now if you pipe the output back to xxd with the -r option and redirect that to a new file, you can convert the hex dump back to binary:

# xxd bdata | xxd -r >bdata2
# cmp bdata bdata2
# xxd bdata2
0000000: 0001 0203 0405