[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

You can convert quantities
expressed in one measurement to their equivalents in another with the
**units** command. The **units** command is an
interactive command. It prompts you for the unit you want to convert
from and the unit you want to convert to.

Note:This command only does multiplicative scale changes. That is, it can convert from one value to another only when the conversion involves a multiplication. For example, it cannot convert between degrees Fahrenheit and degrees Celsius because the value of 32 must be added or subtracted in the conversion.

The **units** command
recognizes **lb** as a unit of mass, but considers **pound** to
be the British pound sterling. Compound names are run together (such as
**lightyear**). Prefix British units differing from their
American counterparts with** br** (**brgallon**, for
instance). The **/usr/share/lib/unittab** file contains a
complete list of the units that the **units** command uses. You
can also define new units in the **unittab** file or create and use
your own *File* that overrides the standard conversion factor values
in the **unittab** file.

Most familiar units,
abbreviations, and metric prefixes are recognized by the **units**
command, as well as the following:

For example, to display conversion factors for inches to centimeters, type:

units you have: in you want: cm

Press Enter.

The **units** command
returns the following values:

* 2.540000e+00 / 3.937008e-01

The output tells you to multiply
the number of inches by `2.540000e+00` to get centimeters, and
to multiply the number of centimeters by `3.937008e-01` to get
inches.

These numbers are in standard exponential notation, so
`3.937008e-01` means `3.937008 x
10`^{-1}, which is the same as
`0.3937008`.

Note:The second number is always the reciprocal of the first; for example,2.54equals1/0.3937008.

For example, to convert a measurement to different units, type:

units you have: 5 years you want: microsec

Press Enter.

The **units** command
returns the following values:

* 1.577846e+14 / 6.337753e-15

The output shows that `5
years` equals `1.577846 x 10`^{14} microseconds,
and that one microsecond equals `6.337753 x 10`^{-15}
years.

For example, to give fractions in measurements, type:

units you have: 1|3 mi you want: km

Press Enter.

The **units** command
returns the following values:

* 5.364480e-01 / 1.864114e+00

The | (vertical bar) indicates
division, so `1|3` means one-third. This shows that one-third
mile is the same as `0.536448` kilometers.

For example, to include exponents in measurements, type:

units you have: 1.2-5 gal you want: floz

Press Enter.

The **units** command
returns the following values:

* 1.536000e-03 / 6.510417e+02

The expression `1.2-5
gal` is the equivalent of `1.2 x 10`^{-5}.
Do *not* type an `e` before the exponent (that is,
`1.2e-5 gal` is not valid). This example shows that
`1.2 x 10`^{-5}` (0.000012)` gallons
equal `1.536 x 10`^{-3}` (0.001536)`
fluid ounces.

If the units you specify after
`you have:` and `you want:` are
incompatible:

you have: ft you want: lb

The **units** command
returns the following message and values:

conformability 3.048000e-01 m 4.535924e-01 kg

The `conformability`
message means the units you specified cannot be converted. Feet measure
length, and pounds measure mass, so converting from one to the other does not
make sense. Therefore, the **units** command displays the
equivalent of each value in standard units.

In other words, this example shows
that one foot equals `0.3048` meters and that one pound equals
`0.4535924` kilograms.

See the **units** command in the *AIX 5L Version
5.1 Commands Reference* for the exact syntax.
**
**