top of page
  • Writer's pictureBent Petersen

Weather forecast in your terminal using wttr.in

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

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

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


You might also be travelling to a special location:

myweather eiffel+tower

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


221 views0 comments

Recent Posts

See All

Comments


bottom of page