How to convert Decimal to Octal, binary, Hexadecimal from command line
Follow @ggarronWhen you work at routing, you will find yourself converting decimal to binary and the opposite, specially for the masks of the IP address, here I will show you how to do it easily using your command line terminal.
Decimal to Hexadecimal
echo 'obase=16;10'| bc
A
Or
wcalc -h 10
Decimal to Octal
echo 'obase=8;10' | bc
12
Or
wcalc -o 10
Decimal to Binary
echo 'obase=2;10' | bc
1010
Or
wcalc -b 10
From Hexadecimal to decimal
echo 'ibase=16;A' | bc
10
From Octal to Decimal
echo 'ibase=8;12 | bc
10
From Binary to Decimal
echo 'ibase=2;1010 | bc>
10
Note: Be sure to have bc or wcalc installed on your system