Get Weather Reports 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.
The service is quite fast, here’s a real time look at weather retrieval in animated gif form:
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:
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.
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;}’
It’s OK, you can say Fahrenheit is better, for human sensitive temperatures anyway ;)
F > C > K
“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?
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.
Stop rationalizing Fahrenheits, no one agrees with you, and no one outside the US ever will.
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).
I think this is very good!
How do I get the weather for Washington, D. C. in the United States?
Thank!
Jim
Jim, for Washington, DC try this:
finger District_of_Columbia@graph.no
For Washington, DC use District_of_Columbia
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
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.]
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.
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?”
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!
Oh get a life will you.
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:
“
”
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:
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.
>> This is one measurement system the USA has right and the rest of the world has wrong.
LoL!! ….
NO.
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.
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!
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
“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.