davka davka - 1 year ago 118
Linux Question

convert binary data to hex in shell script?

feel a bit stupid asking this (sounds as basics) but can't find an answer elsewhere. I want to convert binary data to hex, just that, no fancy formatting and all.

seems too clever, it "overformats" for me. I want to take x bytes from the /dev/random and pass them on as hex.

Preferably I'd like to use only standard linux tools, so that I don't need to install it on every machine (there are many)

Answer Source

Perhaps use xxd:

% xxd -l 16 -p /dev/random
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download