How to convert binary numbers to decimal using the bash shell.

Posted: June 16, 2016. At: 8:28 AM. This was 1 year ago. Post ID: 9278

This one-liner will convert binary numbers to decimal. Very easy to do in the bash shell.

[email protected]:~$ echo "$((2#01110100011000010110101101))"
30508461

This is how to convert binary to Hexadecimal.

[email protected]:~$ printf '%x\n' "$((2#1111111))"
7f

These very useful one-liners should make converting number values even easier.

No comments have been made. Use this form to start the conversation :)

Leave a Reply