Convert A Hex String To Binary And Send With Netcat
Answer : I used the -r and -p switch to xxd : $ echo '0006303030304e43' | xxd -r -p | nc -l localhost 8181 Thanks to inspiration from @Gilles answer, here's a perl version: $ echo '0006303030304e43' | perl -e 'print pack "H*", <STDIN>' | nc -l localhost 8181 Here a solution without xxd or perl : If the echo builtin of your shell supports it ( bash and zsh do, but not dash ), you just need to use the right backslash escapes: echo -ne '\x00\x06\x30\x30\x30\x30\x4e\x43' | nc -l localhost 8181 If you have /bin/echo from GNU coreutils (nearly standard on Linux systems) or from busybox you can use it, too. With sed you can generate a escaped pattern: $ echo '0006303030304e43' | sed -e 's/../\\x&/g' \x00\x06\x30\x30\x30\x30\x4e\x43 Combined: echo -ne "$(echo '0006303030304e43' | sed -e 's/../\\x&/g')" | nc -l localhost 8181 If you have xxd , that's easy: it can convert to and f...