small tip - units conversions with LinuxFollow @ggarron
I am starting to think that no matter the utility you may think about, It may already exists in Linux.
Today I was happily surprised with the existence of
Units, is a tool that converts quantities from one scale to another directly from the command line, i.e. from meters to feet, or from liters to pint
When working in interactive mode, you will enter the quantity and the origin scale, and then the scale you want it converted and you will get the answer, and the system is ready for the next conversion, useful when you want to converte a lot of items.
Use it this way
And you will be able to interact with it like this:
2411 units, 71 prefixes, 33 nonlinear units You have: 1 meter You want: yard 1 meter = 1.0936133 yard 1 meter = (1 / 0.9144) yard You have: 2 liters You want: pint 2 liters = 4.2267528 pint 2 liters = (1 / 0.23658824) pint You have: 1 cup You want: liters 1 cup = 0.23658824 liters 1 cup = (1 / 4.2267528) liters You have:
The first number is the straight conversion, and the second is the inverse, so it means. 1 meter has 1.09 yards, and the second means, 1 yard has .09144 meters.
To exit the interactive mode press CTRL+d
Non interactive mode
You may use it in the non interactive mode, just enter in one line the source and target scales, i.e.
units '3 cups' 'pint'
The output will be:
* 1.5 / 0.66666667