Units (command)
- The correct title of this article is units. The initial letter is capitalized due to technical restrictions.
units is a command line unit conversion program.
The units program converts quantities expressed in various scales to their equivalents in other scales. The units program can handle multiplicative scale changes as well as nonlinear conversions such as Fahrenheit to Celsius.
The units are defined in an external data file (usually found in /usr/share/units.dat
on SuSE), in plain text format, and it is in fact a good source of information in itself. You can use the extensive data file that comes with this program, or you can provide your own data file to suit your needs.
You can use the program interactively with prompts, or you can use it from the command line.
It has a huge database of units, including esoteric and historical units. This for instance allows you to convert velocities specified in furlongs per fortnight, if you really wish.
units has been a standard part of Unix since the early Bell Laboratories versions.
The GNU free software version is written by Adrian Mariano
Contents
Usage
units [option] ['from-unit' 'to-unit']
-h, --help print this help and exit -c, --check check that all units reduce to primitive units --check-verbose like --check, but lists units as they are checked so you can find units that cause endless loops -e, --exponential exponential format output -f, --file specify units data files (-f loads default file) -m, --minus make - into a subtraction operator (default) -o, --output-format specify printf numeric output format -p, --product make - into a product operator -q, --quiet supress prompting --silent same as --quiet -s, --strict suppress reciprocal unit conversion (e.g. Hz<->s) -t, --terse print terse conversion factor output -v, --verbose print slightly more verbose output -V, --version print version number and exit
Examples
Note: Taken from GNU Units homepage.
- Two simple conversion examples:
You have: mile You want: km * 1.609344 / 0.62137119
You have: furlongs per fortnight You want: m/s * 0.00016630986 / 6012.8727
- A calculation involving roots of units:
You have: (400 W/m^2 / stefanboltzmann)^(1/4) You have: Definition: 289.80882 K
- Temperature differences are converted using the syntax shown above with unit names like degC and degF. But conversion of absolute temperatures requires a different syntax:
You have: tempF(45) You want: tempC 7.2222222
Sources
- Most units data was drawn from:
- "NIST Special Publication 811" (1995 Edition)
- "CRC Handbook of Chemistry and Physics" (70th Edition)
- "Oxford English Dictionary"
- "Websters New Universal Unabridged Dictionary"
- "Units of Measure" by Stephen Dresner
- "A Dictionary of English Weights and Measures" by Ronald Zupko
- "British Weights and Measures" by Ronald Zupko
- "Realm of Measure" by Isaac Asimov
- "United States standards of weights and measures, their creation and creators" by Arthur H. Frazier.
- "French weights and measures before the Revolution: a dictionary of provincial and local units" by Ronald Zupko
- "Weights and Measures: their ancient origins and their development in Great Britain up to AD 1855" by FG Skinner
- "The World of Measurements" by H. Arthur Klein
- "For Good Measure" by William Johnstone
- "NTC's Encyclopedia of International Weights and Measures" by William Johnstone
- "Sizes" by John Lord
- "Sizesaurus" by Stephen Strauss
- "CODATA Recommended Values of Physical Constants"
- "How Many? A Dictionary of Units of Measurement"
- "Numericana"
- "UK history of measurement"