three day terminal weather forecast for Llandudno in cool retro term with orange graphics

Windy out? How to check the weather, moon phase and more from your Linux terminal

David Rutland
David Rutland Terminal

Rain or shine, storms, snow, gales, ice, and blistering heat. Weather can seriously affect how you're going to spend the rest of your day, week, month, or even your year.

Dress for a gloriously sunny day in flip-flops, shorts with a natty straw hat, and you're going to have a bad time when an ice storm comes roaring in from the North Sea, and destroys your headwear, before leaving you as a frozen and bruised, wind-burned wreck on the beach.

Likewise, dress for the cold, and you'll find yourself in a puddle of sweat when the clouds lift, and a great fiery ball in the sky sends temperatures rocketing.

Man with umbrella standing next to a signpost near a fog bank

Aside from being able to tailor your outerwear for personal comfort, knowing the weather in advance can help you plan events a few days in advance. There's no point in unpacking and assembling your telescope if the skies are covered all weekends, and you don't want to set aside a day to plant up your allotment, if it's going to rain for the whole of next week.

A weather forecast in your terminal

You can tell what the weather's like right now by looking out of the window, but that doesn't tell you what the conditions will be like this afternoon, or tomorrow. For that, you need a forecast.

Weather forecasts apps and websites are easy to come by. There's probably one baked into your phone's OS, and searching Google for the weather in your location, will give you an idea of what the heavens have in store for you over the next several days.

The problem is that by using any of these services, you're opting into the tracking-based ecosystem that plagues the internet in the 21st century.

The right half of the image is a weather map of he UK, while the left portion is a section of a list of so-called vendors with a toggle switch for each

Even checking the Met Office - the UK government's national weather service exposes you to more trackers, cookies, and 'vendors' than you're probably comfortable with. Sure, those of us lucky enough to live somewhere with adequate(ish) data protection regulations can click on "Reject All" to banish the 241 vendors from our cache, but then we have to put up with DRM warnings.

And the Met Office is one of the easier sites to deal with. Some publishers even put their forecasts behind a paywall, meaning you have to use a dedicated tool to get around the paywall.

wttr.in is a project by Igor Chubin that delivers weather reports to your Linux terminal in a format that's easy to understand, doesn't track you or your online activity, and xxx.

On top of everything else, it's cool as the ninth circle of hell.

cURL your local weather from wttr.in

terminal wttr weather report for Lyme Regis showing current conditions and next three days

cURL is a command-line utility used to sending or getting data using URL syntax. Point it at an ordinary web page, and it will output the HTML contained on that webpage. It's surprisingly sophisticated, and useful for managing HTTP post, SSL connections, proxy support, and FTP uploads. If it isn't already on your list of most used Linux commands, it should be.

curl doesn't come installed on all distros. You can easily install cURL on Debian-based systems, by popping open a terminal and entering:

sudo apt install curl 

To get a three-day forecast for your approximate location (determined by your IP address), just tap:

curl wttr.in

...into your terminal.

Almost immediately, you'll see the current conditions (Patchy rain nearby), followed by a three-day forecast showing weather for the morning, noon, evening, and night - all illustrated with classy ASCII art of the sun peaking from behind clouds, snowflakes, flashing lightning bolts, or whatever's incoming to your region.

The data, including illustrations is presented in a table, and includes a description of the weather, the temperature, a "feels like" temperature, wind speed, visibility, mm of rain expected, and humidity. That's a lot.

Of course, IP determined location is often unreliable. Our wttr.in weather report tells us that it's overcast in Lincoln, which is cool, but we're nowhere near Lincoln.

To get the weather for your actual location, put the name of the nearest settlement as part of the URL.

For instance, to get the weather in the lovely Cheshire market town of Frodsham, you'd enter:

curl wttr.in/frodsham

Simple eh? Apparently, there's light drizzle.

If your local town contains spaces, put a "+" sign between the words. If you want to be reassured that it's also raining in the Jurassic Coast seaside of resort of Lyme Regis, for instance, you'd enter:

curl wttr.in/lyme+regis

By default, the wttr.in weather report displays an abundance of colour, which is fine if you have a standard white on black terminal. We prefer a light terminal background, and because of this, the colours don't show up very well. You can force plain text by adding "/?T" after your location. If you're using a stylised terminal such as Cool Retro Term, you may find this helps with visibility.

More weather modes

Maybe you don't want a three-day graphical weather report in your terminal. Perhaps you like things simpler, or even extra snazzy, or extra-detailed.

In all cases, wttr.in has you covered.

If you just want quick weather output for one or more locations, you can add "?format=3" to the end of your location string. For instance:

curl wttr.in/Liverpool?format=3

Or if you want the current conditions in multiple potential holiday destinations, use curly braces, with the locations separated by commas:

curl -s 'wttr.in/{rhyl,llandudno,bodfari}?format=3'

The -s switch tells curl to operate silently.

short weather output for rhyl, llandudno, bodfari, gwent, and swansea

If you want specific information, wttr.in accepts inputs following the "%" symbol. The full list is available on the project page, but a few of our favourites are: moon phase (m), uv index (u), Dawn (D), and dusk (d). To view all of these for our the perpetually rainy northern town of Wigan, we would enter:

curl wttr.in/wigan?format="%m:+%u+%D+%d\n"

For a more detailed and dedicated tool for checking out moon phases in your terminal, we recommend Pyphoon.

If you like graphs, charts, and data, you'll love v2.wttr as it gives you (among other things): temperature, and rain forecast through the next three days, moon phases, timezone for your chosen location, dawn, sunrise, noon, sunset, and dusk - all presented in a very sophisticated, visual way.

wttr output with graphs

To access the data-rich version, simply use v2.wttr.in as the base URL:

curl v2.wttr.in/wigan

There's more to wttr than weather

Of course, this article barely scratches the surface of what the combination of curl and wttr is capable of. While we're not technically low on space here, it makes more sense to highlight the basic usage, and features we actually use, rather than paraphrase the entire manual.

Notable features we haven't covered include a variety of output formats, cool maps, integrations with Conky, and multilingual locations names. Visit the project's GitHub page and check it out.