Hacker News new | ask | show | jobs
by stevefeinstein 3275 days ago
TIL: units is a really useful utility command that I had forgotten even existed.
2 comments

It does induce a geeky joy but it's ephemeral for the most part as Google is vastly superior in usefulness. I learned about units few years back, used it for a while, and I can't even remember when but I just started Googling the conversions instead of switching to the terminal window.
I mostly use Spotlight (on OS X) to do conversions since it saves me switching to the browser or terminal. It doesn't handle as advanced conversions as Google does but it handles 90% of my common cases (including currencies)
Damn, I didn't know Spotlight could do this. Thanks!
I don't think Google can convert millilightseconds to miles at one go. The units program has support for much more esoteric units than Google does.

  You have: 100 millilightseconds
  unknown unit 'millilightseconds'
  You have: ^D
Apparently I need to add more units to achieve this level of usefulness.
Something tells me you're on OS X, and like myself, you'll find you mostly want everything replaced with GNU binaries:

  $ brew install gnu-units
  $ gunits
Also see: https://apple.stackexchange.com/questions/69223/how-to-repla...
Well

  user@server:~$ units -V
  GNU Units version 2.11
  with readline, with utf8, locale en_US
  Units data file is '/usr/share/units/definitions.units'
  Personal units data file is '/home/user/.units'
    (file does not exist)


  Copyright (C) 2014 Free Software Foundation, Inc.
  GNU Units comes with ABSOLUTELY NO WARRANTY.
  You may redistribute copies of GNU Units
  under the terms of the GNU General Public License.

  user@server:~$ units
  Currency exchange rates from www.timegenie.com on 2014-04-02
  2866 units, 109 prefixes, 79 nonlinear units

  You have: 3millilightseconds
  You want: miles
          * 558.84719
          / 0.0017893979
  You have:
  user@server:~$
Works for me.
try "3 ms"