The Linux command ‘units’ may or may not be installed on your system. If not, if you use synaptic or apt, type (at the prompt)
sudo apt-get install units
or equiviliant for other distributions. Then type in the word “units” and play around. Here are a few sample outputs:
The program is a little clunky. You have to know the specific codes for each type of measurement, though ‘units’ will figure out what you mean sometimes. To exit, type ctrl-D. There is a way to use this utility in a script. That and other details are found in the manual.
You can also use the google search box, such as: 3 parsecs to lightyears for example.
Bill: Thanks. I was going to mention, but forgot, that you can get often better results, with more understanding of your particular vocab, from Google. Right after writing this post up I needed to convert grams to oz, and units would not do that because I did not know the term for oz as in weight as opposed to volume. Google understood my needs and met them.
But, google is clumsy in a script, and if you do this a lot with certain conversions units is probably faster. Plus, as a GPL utility, it is verifiable. I’m not sure if Google’s conversion is, so it may not be suitable for science (good chance it’s the same utility with a front end, though.)
Well, oz _is_ the unit of weight. The fluid ounce is abbreviated fl oz.
If units is using oz for the fluid ounce and never as the ounce itself, then units is doing it wrong.
Rick, I’m not doubting you but what do you base that on?
Oh, and I was trying to convert ml to oz. But, it still doesn’t function as expected, i.e., “fluid ounce” is not recognized as a unit, nor is “fl oz” … after five or six unsuccessful guessies one reaches for Google. The units utility should know which ounce one is looking for if volume vs. weight is the first measurement. But, it is open source and thus fixable, unless there is some philosophical barrier here.
Start with units -v (verbose, my preference), type fl and hit the tab key: flag flock flour_sifted fluiddram fluorine fldr florin flour_spooned fluidounce fluxunit flemishell flour_scooped floz fluidscruple
fluidounce or floz will get you fluidounce = usfluidounce = 1|16 uspint = 2.957353e-05 m^3
Chris: Thanks. So what quantity is measured in “fluorines”?
I’ve always been fond of ConvertAll. It’s usually run as a GUI, but it works just fine as a CLI app. I like it because you can make units out of other units easily. lb / acre == 1.1208512 kg / hectare, for example.
It also doesn’t know how to translate cubits to meters 🙂
I use Google Calc almost daily at work to work out bandwidth requirements for customers. From what you’ve shown above it looks like units syntax is far more forgiving than Google’s – which generally needs to be phrased as an algorithm of sorts. i.e. (10Mb*2592000)*.6=?TB
answer is 1.85394287TB in each direction over a 10Mbps connection, over 30 days allowing for ~40% tcp/ip packet overhead.
Glad to finally find an answer to the fluid ounce problem with the units application. I want to add this all-important shortcut:
ctrl + t (opens terminal)
units “100 ml” “floz”
(returns 3.3814023 — maybe I’ll go with the 150 mL flask)
I much prefer this quick keyboard action to Google for my conversions, and it’s no competition when my browser is not running.