cheat.sheets:hexdump
# side-by-side hexadecimal and ASCII view of the first 128 bytes of a file
hexdump -C -n128 /etc/passwd
# Convert a binary file to C Array
hexdump -v -e '16/1 "0x%02X, "' -e '"\n"' file.bin > hexarray.h
# Convert a binary file to Shell code
hexdump -v -e '"\\""x" 1/1 "%02x" ""'
# Generate random MAC address
hexdump -n6 -e '/1 ":%02X"' /dev/random|sed s/^://g
tldr:hexdump
# hexdump
# An ASCII, decimal, hexadecimal, octal dump.
# More information: <https://manned.org/hexdump>.
# Print the hexadecimal representation of a file, replacing duplicate lines by '*':
hexdump path/to/file
# Display the input offset in hexadecimal and its ASCII representation in two columns:
hexdump -C path/to/file
# Display the hexadecimal representation of a file, but interpret only n bytes of the input:
hexdump -C -nnumber_of_bytes path/to/file
# Don't replace duplicate lines with '*':
hexdump --no-squeezing path/to/file
$
cheat.sh