Weather forecast in your terminal using wttr.in

Bent Petersen
2 min readJul 24, 2020

As a bioinformatician, I love my terminal. The terminal is where I work and what I see the most.

If you are wondering what the weather will be like and you are feeling a little nerdy and too lazy to open a browser, you mind find this little code a bit interesting.

1. Open your favourite terminal
2. Type the following code

function myweather(){
curl wttr.in/$1
}

3. With a simple command, you can now see the weather forecast in ASCII-characters

myweather
Weather report for Copenhagen, Denmark

The weather forecast is obtained using your IP-address if you want the weather forecast for a specific location you can now obtain it like this:

myweather rio
Weather report for Rio, Brazil

If you are travelling a lot and thinking in 3-letter Airport-codes:

myweather KUL

As you can see from the picture below, they the airport-code is looked up and the weather forecast for “KLIA, KLIA Arrival, Sepang, Selangor, 64000, Malaysia [2.74552395,101.701506799265] is received

Weather report for KLIA airport Malaysia

You might also be travelling to a special location:

myweather eiffel+tower
Weather report for Eiffel Tower, Paris

There are loads of other features, which all can be used in your terminal or even implemented as a widget or at your website.

Check out all the features at Igor’s Github-page: https://github.com/chubin/wttr.in

This post was originally posted at my Blog: https://www.bpetersen.dk/post/weather-forecast-in-your-terminal-using-wttr-in

--

--

Bent Petersen

Associate Professor in bioinformatics at the University of Copenhagen, Denmark