Is there an obvious way of shifting numbers in the gcalc-tool using an operator, such as << or >>
Am I missing an obvious shortcut?
Say I want to simply perform (1<<20), how can I do that without the need to shift by 15 and then by 5 using the drop-down buttons?

Alternatively, is there a good hex/binary calculator that you would suggest specifically oriented at hex/binary operations?



From what I have seen Gnome Calculator does not have keyboard shortcuts to those functions. Either way Qalculate lets you do exactly that.

enter image description here

To install either search it in Software Center or using terminal:

$ sudo apt-get install qalculate-gtk

BASH also supports bitwise operations like bitwise or:

$ echo $((1|2|4|8|16))

Hex and decimal:

$ echo $((1|2|4|8|0x10|0x20))

Zero-prefixed binary output (using BASH for the bitwise or, dc to output its binary, and printf to zero-prefix):

$ printf "%08s" $(dc -e "2o  $((1|2|4|8|0x10|0x20)) p")

Good for quick-and-dirty. man bash

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.