linux - Convert string to hexadecimal on command line -
i'm trying convert "hello" 48 65 6c 6c 6f in hexadecimal efficiently possible using command line.
i've tried looking @ printf , google, can't anywhere.
any appreciated.
many in advance,
echo -n "hello" | od -a n -t x1 explanation:
- the
echoprogram provide string next command. - the
-nflag tells echo not generate new line @ end of "hello". - the
odprogram "octal dump" program. (we provide flag tell dump in hexadecimal instead of octal.) - the
-a nflag short--address-radix=n, n being short "none". without part, command output ugly numerical address prefix on left side. useful large dumps, short string unnecessary. - the
-t x1flag short--format=x1, x being short "hexidecimal" , 1 meaning 1 byte.
Comments
Post a Comment