Convert decimal numbers to binary

\"SYDNEY,
Image by Getty Images via Daylife

There is a calculator called bc that works in the command line. So if you need a quick calculator function in the command line then you could write some functions that will do the trcik for you. Here is an example:

function convBase { echo \"ibase=$1; obase=$2; $3\" | bc; }

so, if you want to convert decimal number to hex number then you could type

convBase 10 16 16

\"Reblog

4 thoughts on “Convert decimal numbers to binary”