top | item 44500625

(no title)

bqmjjx0kac | 7 months ago

I always want to reach for `units`, but I'm perennially baffled by the output! What's up with the * and /?

discuss

order

Arnavion|7 months ago

The * value is the result of converting 10 miles to meters, as requested.

The / value is the inverse of that in case you wanted that, ie 0.1 meters in miles.

It's explained in `man 1 units`

bqmjjx0kac|7 months ago

Oh, I know it's explained in the man page. I read it every time and promptly forget because I can't internalize the choice of notation.

Symbiote|7 months ago

I usually call it non-interactively:

  $ units 1500DKK USD
      * 236.76653
      / 0.00422357
in which case it's always the first line I want.

(The second line is telling me 1USD is 0.00422357 of 1500DKK.)

Note if you use the currency conversions,

  systemctl enable units-currency-update.timer
is needed to keep them up-to-date.

tmtvl|7 months ago

If you only need the first line you can invoke units with --terse.

  $ units --terse 2.4kWh megajoules
  8.64

barnas2|7 months ago

the * is denoting the conversion from your first unit to your second, the / denotes the other way.

You have: 1 miles You want: feet * 5280 / 0.00018939394

In the above example, 1 mile is 5280 feet, and 1 foot is 0.00018939394 miles

If I do 2 miles to feet, the values are doubled (or halved for the reverse conversion)

You have: 2 miles You want: feet * 10560 / 9.469697e-05