APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed


© October 2003 Tony Lawrence

This is a converter. It gives you conversion factors for feet to inches, miles to meters, that sort of thing. It can be used directly at the command line or interactively. You can modify the data file it uses or create your own for special purposes.

bash-2.05a$ units ton grain
        * 14000000
        / 7.1428571e-08

Which tells you that you'd need to multiply by 14000000 to convert tons to grains. Interactively:

bash-2.05a$ units
501 units, 41 prefixes

You have: 4 meters
You want: inches
        * 157.48031
        / 0.00635
You have: 

The /usr/share/misc/units.lib (could be different on your system) is the file that tells units how to do its conversions; you can add to that or provide your own file:

bash-2.05a$ cat med
aspirin                 !a!
headache                        2 aspirin
bash-2.05a$ units -f med headache aspirin
        * 2
        / 0.5

Units can only do simple math; it can't convert Fahrenheit to Centrigrade. It can do currency conversions, but you'd need to keep its file up to date.

Of course today we have Google, which can answer many such problems itself or find you a calculator to do it.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> units

Inexpensive and informative Apple related e-books:

Take control of Apple TV, Second Edition

Take Control of Numbers

Sierra: A Take Control Crash Course

Take Control of Pages

iOS 10: A Take Control Crash Course

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

The computer is a moron. (Peter Drucker)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode