10

How can we convert a hexadecimal value into decimal by using calculator (I know by using general formula we can do ,but is there any short key or button to do this)?

(I tried but didn't found any option )

13

You can use Ubuntu's default calculator in programming mode.

Open the dash and search for Calculator, then select : Mode > Programming Mode.

screenshot

Enter the value to convert, then press equal =. The entered value will get bolded. Then you may select the target Base from the drop-box to have the value converted.

  • 2
    This does not actually convert the number, but rather just displays it in the tool, making it impossible to use the number for further calculations. – DustWolf Oct 6 '16 at 7:09
12

And if you want something you can do from the command line, you can use trusty old bc

echo "obase=16; 255" | bc

produces FF

3

When I need to convert to hex from command line, I do this:

printf  "%x\n" 255

and when I need to convert from hex, it get simpler:

echo $((0xff))
2

Well, I don't do it often but, when I do, I just use Galculator. Why do I use Galculator? It is fast, light, and feature rich. It does everything I need it to do, these days.

If you're looking to convert then simply enter the information and then click on the appropriate button (DEC HEX OCT BIN) and it converts it for you all nice and easy like. Most of all, it's pretty small and easy to work with - I like small and simple and I also like a GUI for some things.

If you want to install it then sudo apt-get install galculator and follow the prompts.

  • I do not like it at all. You don't get instant representation of hex,bin values like Calculator in accepted answer. – Vassilis Oct 2 '16 at 4:10
1

dc(1)

Desktop Calculator, absolutely:

> dc <<< '16i FF p'
255
  • 16i is for input base16
  • p for print

PS Other useful conversions:

> dc <<< '16o 255 p'   # decimal2hex
FF
> dc <<< '2o 16i EF p' # hex2binary
11101111
> dc <<< '2o 7 p'      # decimal2binary
111

@see http://wiki.bash-hackers.org/howto/calculate-dc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.