Created
January 28, 2012 00:31
-
-
Save kmajetic/1691795 to your computer and use it in GitHub Desktop.
Convert decimal to binary and the opposite using command line terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Decimal to Hexadecimal | |
10->A | |
echo 'obase=16;10'| bc | |
Or | |
wcalc -h 10 | |
Decimal to Octal | |
10->12 | |
echo 'obase=8;10' | bc | |
Or | |
wcalc -o 10 | |
Decimal to Binary | |
10->1010 | |
echo 'obase=2;10' | bc | |
Or | |
wcalc -b 10 | |
From Hexadecimal to Decimal | |
echo 'ibase=16;A' | bc (case sensitive) | |
From Octal to Decimal | |
echo 'ibase=8;12' | bc | |
From Binary to Decimal | |
echo 'ibase=2;1010' | bc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment