Checking the Weather Forecast at the Command Line

Here's the latest in an irregular series of short posts that introduce a few Linux terminal tricks.

Besides sticking your head out the window, what do you do when you want to find out what the day's weather is going to be like? Chances are you jump over to a weather service website or fire up an app on your phone.

Why not crack open a terminal window instead? All you need is a command line utility called cURL. cURL is standard kit with most Linux distributions. If it isn't installed on your computer, you can get cURL using your package manager.

How do you use cURL to check a weather forecast? At the command line, type this:

curl wttr.in

Then, press Enter. Something like this displays after a few moments:

Using cURL to grab a weather forecast

The wttr.in in the command, in case you're wondering, is a console-oriented weather forecast service. cURL goes to the internet and grabs weather information from wttr.in. In turn, wttr.in determines the forecast for your location using your IP address.

If you're masking your IP address, you can get the forecast for where you are by adding the name of your city to the command. Let's say you're in Osaka, Japan. Get your weather forecast by typing:

curl wttr.in/Osaka

Do that to get the forecast of another city as well. You can also use three-letter airport codes or the name of an attraction (like the CN Tower) view the forecast for a locale. You can learn more by reading the documentation.

Scott Nesbitt

#linux #cli