Article submitted by Geoffroy Youri Berret. We are running out of articles ! Please help DPOTD and submit good articles about software you like !
units is a command-line tool which performs units conversion between various scales. units is the perfect tool for engineer or scientific workstation, you can call it either interactively from the prompt or within command line. It already handles more than two thousand units and this can be enhanced with your own units in a separate data file.
units handles multiplicative scales factor as well as non-linear conversions units such as Celsius Fahrenheit. Compound units are also allowed in order to deal with quantities such as speed, volume, energy, etc.
Calling units without any option will run it interactively. Here is an example showing how to convert cm3 to gallons:
%units 2438 units, 71 prefixes, 32 nonlinear units You have: cm^3 You want: gallons * 0.00026417205 / 3785.4118
units returns two conversion rates. The first one is the convertion factor you asked for, the second is its inverse or the conversion in the oposite direction. Sometimes the inverse factor could be more convenient because it would be the exact value.
units also provides the definition of units of you leave ‘You want:’ field empty:
You have: ohm You want: Definition: V/A = 1 kg m^2 / A^2 s^3
Or you may want to compute sums of conformable units:
You have: 2 hours + 46 minutes + 40 seconds You want: seconds * 10000 / 0.0001 You have: 20 inches + 15 cm - 1 foot You want: cm * 35.32 / 0.028312571
And finally, not a minor feature when you have to deal with so many units, the completion with the tab key. It will complete unitname if there is a unique way to do so or provide a list of possibility with the second hit of the tab key :
You have: metr metre metriccup metrichorsepower metrictenth metretes metricfifth metricounce metricton metriccarat metricgrain metricquart metricyarncount You have: metr
units [options] [from-unit [to-unit]]
Invoking units with options will turn off the interactive mode and return conversion to stdout :
%units '2 liters' 'pints' * 4.2267528 / 0.23658824
gnu units has been available in Debian since Sarge and in Ubuntu since Warty.
- Homepage: http://www.gnu.org/software/units/units.html
- Units manual: http://www.gnu.org/software/units/manual/index.html