Skip to content

hexdump

Practical hexdump usage examples for inspecting, debugging, and transforming binary data streams on Unix-like systems


View the system memory in clear text

hexdump -e '90/1 "%_p" "\n"' /dev/mem 

Pretend to be busy in office to enjoy a cup of coffee

while [ true ]; do head -n 100 /dev/urandom; sleep .1; done | hexdump -C | grep "ca fe"

Pretend to be busy in office to enjoy a cup of coffee

cat /dev/urandom | hexdump -C | grep "ca fe"

Generate 30 x 30 matrix

hexdump -v -e '"%u"' </dev/urandom|fold -60|head -n 30|sed 's/\(.\{2\}\)/\1 /g'

Hear the mice moving

  • This require beep to be installed
while true; do beep -l66 -f`head -c2 /dev/input/mice|hexdump -d|awk 'NR==1{print $2%10000}'`; done

Dump a web page

  • Useful to browse dangerous web sites
curl -s http://google.com | hexdump -C|less

Generat a Random MAC address

hexdump -n6 -e '/1 ":%02X"' /dev/random|sed s/^://g
hexdump -n6 -e '/1 "%02X:"' /dev/random|sed 's/:$/\n/'

Convert binary data to shellcode

hexdump -v -e '"\\""x" 1/1 "%02x" ""' <bin_file>

Print first n characters of any file in human readble form using hexdump

hexdump -C -n 20 filename

Hexadecimal dump of a file, pipe, or anything

cat testfile | hexdump -C

Print all characters of any file in human readble form using hexdump

hexdump -c <file>

Convert ascii string to hex

echo -n text | hexdump -C