I was searching for how to do a reverse hexdump and found xxd mentioned. However, it does not seem to work with simply:
xxd -r hexdumpfile > binaryfile
I then compared the difference between outputs of xxd infile
and hexdump infile
, and found three differences:
- xxd output has a colon after the address
- xxd output has the positions in the data reversed (for example,
5a42
in hexdump output becomes425a
in xxd output) - There are some extra characters after each line
I only have the hexdumped version of certain files on a server. How can I correctly get back the binary data using xxd?
hexdump
allows you to choose the endianness used in its output, which could make this simpler. (Why now? Found your question helpful for something unrelated.)