I stumbled across this today, a way to do hex conversions from the command line. Not only did I find such a tool, but I found a pretty cool calculator as well.
bc is a GNU command line tool included with most Unix distros (OS X, Linux).
Hex to Decimal Conversion
bc you can do basic conversions from the command line in a manner like this:
echo "ibase=16; hex-number"|bc echo "ibase=16; F"|bc
bc performs all operations in decimal. To convert from hexidecimal to decimal set the input base system to hexidecimal with the command “ibase=16;”. Then, any hex number will be converted to decimal for you.
Decimal to Hex
To convert to decimal to hexidecimal, set the output base to sixteen with “obase=16;”. For example:
echo "obase=16; decimal-number"|bc echo "obase=16; 10"|bc
Decimal to Binary
And of course you can go decimal to binary:
echo "obase=2; 7"|bc
It does Math too
You are not limited to conversions you can do math too:
bc Interactive Mode
Finally, I must mention you do not have to do everything from the command line. If you just run
bc from the command line, you can do all of this interactively.