I\'m now doing it this way:
[root@~]# echo Aa|hexdump -v 0000000 6141 000a 0000003 [root@~]# echo -e \"\\x41\\x41\\x41\\x41\" A
For the first part, try
echo Aa | od -t x1
It prints byte-by-byte
$ echo Aa | od -t x1 0000000 41 61 0a 0000003
The 0a is the implicit newline that echo produces.
0a
Use echo -n or printf instead.
echo -n
printf
$ printf Aa | od -t x1 0000000 41 61 0000002