Get Weather Reports from the Command Line with finger

Feb 18, 2016 - 21 Comments

Get weather forecast from the command line with finger

There’s no shortage of methods to retrieve a weather report, the web is full of weather resources, everyones iPhone, Apple Watch, and smartphone has a weather app, Siri can tell you the weather, and you can even get the current weather in the menu bar of OS X or from Spotlight on the Mac too. But for command line users, none of those options are particularly ideal, since it means leaving the command line and the task at hand. Thanks to an interesting usage of the finger utility, you can quickly retrieve a weather report and weather forecast for virtually any city in the world, right from the command line.


With this trick you’ll see the temperature forecast (in celsius) for the day, wind direction and wind speed, precipitation and precipitation type (rain, showers, sleet, snow, etc), depth of precipitation, and more. This works with any command line that has the finger tool, whether you’re in Mac OS X, linux, BSD, Windows, it doesn’t matter, it will work the same.

To try this out yourself on the Mac, launch the OS X Terminal found in /Applications/Utilities/ and type the following command syntax:

finger (city name)@graph.no

For example, to get the weather forecast for Montreal Canada, you would use the following syntax at the command line:

finger montreal@graph.no

This will return a full graph of weather and forecast in ASCII format, with extended details about the temperature and weather types.

Get weather forecast from the command line with finger

The service is quite fast, here’s a real time look at weather retrieval in animated gif form:

Get the weather report from command line with finger

One potential frustration for those in the USA is weather temperatures are reported in the globally acknowledged Celsius rather than the more physically precise Fahrenheit, and at the moment there is no way to change that, but that’s not much of a complaint and you can always get Siri to convert Celsius to Fahrenheit for you if need be.

You can also get a shorter forecast by prepending o: to the city name like so:

finger o:montreal@graph.no

That will report a much shorter version of the forecast without having the ASCII temperature graph, looking like the following:

montreal at 22:00: -6 C, 5.3 mps wind from W.

The shorter version is shown at the bottom of the screenshot:

weather forecast from the command line with finger

Again, adjust the city name to get a different city forecast.

This is a pretty handy tool for getting weather from the command line quickly, and the short version is great for scripting, the MOTD, or quick checks.

If you know of another method to retrieve forecasts, temperature, weather, and other meteorological data from the command line, share it with us in the comments.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Tips & Tricks

21 Comments

» Comments RSS Feed

  1. Robert Bittle says:

    I’m not saying it’s better, but if Fahrenheit is what you are used to, you can run:

    finger montreal@graph.no | sed “s/’C/’F/” | sed ‘s/^ \?-\?[0-9]\+/{\0{/’ | awk -F{ ‘{if($2 != “”) printf “%3i%s\n”, $2*1.8+32, $3; else print $1;}’

  2. not overly impressed says:

    “temperatures are reported in the globally acknowledged Celsius rather than the more physically precise Fahrenheit”

    Physically precise???

    You’ve been watching Spinal Tap…your amplifier is better because it goes to 11?

    • Impressed says:

      Fahrenheit has a broader numerical scale within the range of Earth experienced temperatures without requiring decimals, that alone is considerably more precise to human acknowledged temperature differences. Maybe if you’re from Venus you would find Kelvin to be an appropriate scale, and perhaps if you primarily revolve around freezing water and boiling water Celcius would be appropriate to you. This isn’t rocket science though, most earthlings are in moderate climate zones and unless you live in a volcano or antarctica (before it all melts!) you’d like fahrenheit too.

      Metric is obviously better for most measurements, but the F temperature scale is one thing the USA and Burma have right.

  3. Stephanie says:

    This is great, but I found that smaller, unpopular cities (i.e.: Mechanicville, NY) are not found and bounces back with the “yr.no is having technical problems, or you specified an unknown location”. Also, no command for searching for duplicate cities across U.S. if postal code is unknown (i.e.: Albany, NY vs Albany, GA).

  4. Jim says:

    I think this is very good!

    How do I get the weather for Washington, D. C. in the United States?

    Thank!
    Jim

  5. Kurt Pfeifle says:

    Here is another command line which gives you a weather forecast:

    curl wttr.in

    It will automatically guess your current geo-location and output a 3-day forecast.

    If you want to override the geo-location guess and ask for a specific place, just add it like so:

    curl wttr.in/berlin

  6. Fnordmeister says:

    Another frustration for those of us in the USA is the message that I got when I tried this:

    [You can not use US zip codes here. Try finger @graph.no.]

  7. Try this, instead:
    curl http://wttr.in/Montreal
    It has a much better presentation.
    P.S. Get used to Celsius. The whole world except the USA understands it.

  8. yyz guy says:

    I cannot feel a one degree difference with F, but can with C.

    I’m an American that prefers SI units.

    We’re getting there one inch at a time.

    BTW, how does the rest of the world express “film footage?”

    “Metreage?”

  9. Louise says:

    Comments such as

    >>>This is one measurement system the USA has right and the rest of the world has wrong.

    are what help fuel the worldwide anti-USA fire!

    • Lemon4611 says:

      Oh get a life will you.

    • Sally Mander says:

      Fahrenheit is more precise, and humans are more sensitive to subtle differences in temperature, thus fahrenheit and is simply better as a human understandable temperature scale for weather and ambient temperatures. Meanwhile, Celcius is based on water temperature, what are we fish? No we are humans, well I am anyway I am not sure about the rest of your readers they could be salmon or anchovies, but us humans, we breathe air, give me the air temperature scale of Fahrenheit anyday. This sums it up well:

      With Fahrenheit, you’re really cold at 0°F and really hot at 100°F; with Celsius, you’re cold at 0°C and dead at 100°C.

      Yup, that’s right, Fahrenheit is better than Celcius. The USA is right about this one! The rest of the metric system is good, but temperatures the USA has right. Fahrenheit! Fahrenheit!

      http://thevane.gawker.com/fahrenheit-is-a-better-temperature-scale-than-celsius-1691707793

      And going further:

      “- the Centigrade scale throws away 70% of the digits it could use
      – Fahrenheit’s first digit provides a good ballpark
      – You don’t need to even use all of the second digit in Fahrenheit, just “upper, mid, lower” — versus needing a third number (decimal) in Celsius.

      Fahrenheit is calibrated with 0 being the coldest weather you’re likely to encounter and 100 being the hottest weather you’re likely to encounter in most climates. (Although there are certainly places on Earth with temperatures regularly even higher or even lower.)”

      https://www.quora.com/Is-Fahrenheit-better-than-Celsius-for-weather-reports

      Folks, just admit it, Fahrenheit is better. It’s more precise. It’s perfect for human readable temperatures.

  10. Meh says:

    >> This is one measurement system the USA has right and the rest of the world has wrong.

    LoL!! ….

    NO.

  11. Ted Cruz the Cuban Rubio Loves Trump says:

    Fahrenheit is a far superior temperature gauge for humans, it is precise and easy to interpret. This is one measurement system the USA has right and the rest of the world has wrong.

    The graph.no service is working to improve international weather reports, some cities are not included and some cities reference improper locations if you go obscure, so watch as the service improves over the coming weeks.

    • jonathan says:

      Why oh why, do USA-ians think they are so much better with their antiquated imperial (read ‘bits and pieces’) systems of measurements. Only three countries left in the world who do not use the metric system. I have to convert Fahrenheit into Celsius to understand what it means.

      We metricated in the 1970s and it is about time the USA did too!

      Get with the programme – and another thing your spelling is very strange!

      Just in fun!

      • Kris says:

        Sadly I must agree here. I am from the US and still I believe our measurement system sucks. I can remember being told in back in grammer school that we must learn Metric. As that is the way of future. Hmmm that was in the 80s? WTF

    • Börje Forssell says:

      “far superior temperature gauge” is of course nonsense! It depends on what you are used to. Sticking to those obsolete measurement unities (Fahrenheit is just one example) as you do in the US shows that you are centuries behind the rest of the world in many aspects.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site