Is there a command line calculator for byte calculations?

Is there a command line calculator for linux where I can do the following:

 calc 560kB/12233kB

eg. The required basic arithmetic and answers are given as decimal (in the case above) or with the corresponding SI prefix (kB, B, MB, GB, etc.).

Can it bcdo the trick somehow?


Decision

GNU Units is doing what I wanted.

+4
source share
1 answer

You can use bcfor this if you remember what number unitis actually a shorthand for number * unit. One limitation bcis that it only allows lowercase variables:

b=1
kb=1024
mb=1024*kB
...

scale=20
(560*kb)/(12233*kb)
.04577781410937627728

, , Python .

+4

All Articles