3 Answers
3

There's a printf tool that simulates the C function; normally it's at /usr/bin/printf, but a lot of shells implement built-ins for it as well. You can use %02x to get the hex representation of a character, but you need to make sure you pass a string that includes the character in single-quotes (Edit: It turns out just a single-quote at the beginning is sufficient):

xxd is a hex-dump utility shipped as part of the vim-common package
It has a handy -p option which outputs a continuous 'plain/postscript' hexdump style.. This can eaisly be reversed via -r... -u will output upper-case Hex-Digits.