Linux Tricks

xxd

xxd is built-in Linux. create a file with hex representation. For example:

 echo "00: 68 65 6c 6c 6f" > xxd_hex

convert to raw bites with xxd:

xxd -r xxd_hex

printf

printf "\x68\x65\x6c\x6c\x6f"

echo

echo $'\x68\x65\x6c\x6c\x6f'

python3

python3 [or python] may not exist on the machine.

python3 -c "print('\x68\x65\x6c\x6c\x6f')"

If you don't want unreadable characters to be interpreted as UTF-8 with python3 use this instead:

python3 -c "import sys; sys.stdout.buffer.write(b'\xca\xfe\xba\xbe\n')"

Other

http server with python

python3 -m http.server

Last updated