This manual describes how to use the UDUNITS-2 program. This program allows you to discover the definition of a unit as well as convert numeric values between compatible units.
udunits2 -h udunits2 [-A|-L|-U] [-r] [-H have] [-W want] [XML_file]
The following options and arguments are supported:
haveunit for conversion. The default is the reply to the prompt.
wantunit for conversion. An empty string requests the definition of the
haveunit. The default is the reply to the prompt.
When successfully started without the
-H have or
-W want options, the program will
At this point you can exit the program by entering the end-of-file character (usually control-D) or continue by entering either a value or a unit. (a value comprises a numerical value and a unit. For example:
You have: 80 km/h You want:
At this point, if you enter a blank line, then the program will assume that you entered a unit in the previous line and will print the definition of that unit in terms of the base units of the unit-system that it imported on startup. For example:
You have: 80 km/h You want: 22.2222222222222 m.s-1 You have:
Details of the formatting depend on the character-set being used. See Options.
Alternatively, at the “You want:” prompt you can enter the unit in which you want the previously-entered value. For example:
You have: 80 km/h You want: mi/h 80 km/h = 49.7097 mi/h x/(mi/h) = 0.621371*(x/(km/h)) You have:
The first line after “You want:” shows the “have” value in the desired “want” unit.
The second line shows the transformation between numerical values in the “have” unit to numerical values in the “want” unit. The symbol “x” represents the physical quantity in question. See NIST Special Publication 811.
See UDUNITS-2 in The UDUNITS-2 C API Guide, for information on the UDUNITS-2 library, which is used by this program.