Lesser known linux commands : units

units is a command which help us to convert between different units of measure like feet into meter etc.

Let us see few examples

ram@rhlaptop:~$ units

2411 units, 71 prefixes, 33 nonlinear units

You have: foot

You want: cm

* 30.48

/ 0.032808399

You have: acre

You want: meter^2

* 4046.8726

/ 0.00024710439

You have: tempF(100)

You want: tempC

37.777778

As you can see it is pretty useful. How to interpret the results?. The first line if has a * means it should be multiplied.

For example in foot to cm conversion, following formula helps

1 foot = 30.48 * 1cm.

The second line shows the reverse, i.e cm to foot conversion, here division should be applied. For example cm to foot

cm =foot / 0.032808399

You can even give exact value that you want to convert. Say 10feet

You have: 10feet
You want: cm
* 304.8
/ 0.0032808399

As for as non-linear units like Fahrenheit to Celsius, there is a function like syntax as you can see in the third example.

The information about units is usually at /usr/share/misc/units.dat. A look at this file is good as it throws lot of information – reminding me about clarke’s table in school/college days.

One Response to Lesser known linux commands : units

  1. Dr.A.Elangovan says:

    Dear Mr.Raman, CONGRATULATIONS! Informative and useful web contents in your web.
    Keep it up!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: