How to Check Weather Forecast via the Command Line

By | October 6, 2015

We often check our local weather forecast from the Linux desktop. Sometimes checking your forecast is more easier If you could check your weather forecast from the terminal environment when you don’t have access to your desktop environment.

There are many ways you can do to access weather forecast (ex standalone weather apps, desktop widgets, or panel applets. But if your work environment is a terminal based there is also several ways to access it. One of the way is by using wego, a cute small applications weather apps for your terminal.

This apps using ncurses-based interface, with wego you can check your current weather conditions and forecast in a flash on your terminal. It can retrieves weather forecast for the next 5 days from the API. Let’s we install the app and test it out !.

How to Install Wego on Linux

The installation is simple, the first step is install the Go Language. After installing you can proceed to this step.

$ go get github.com/schachmat/wego

The wego will be installed under your $GOPATH/bin. So add new path to your $PATH variable like this.

$ echo 'export PATH="$PATH:$GOPATH/bin"'  >> ~/.bashrc
$ source ~/.bashrc

The installation completed.

Using wego

Before using wego, we need a configuration file so we can specify a weather API key to determine our location. To get a configuration file, simply just run wego for the first time.

$ wego

It will generated the configuration file on ~/.wegorc. Now let’s get your API key from worldweatheronline.com, don’t worry it’s free, just sign up is quick and easy.

Check Weather Forecast from the Command Line with Wego

Get your API Key

Your API key is locate on the red box. After getting your API key it’s time to configure your wegorc file. Let’s configure it by opening the file with your favorite text editor.

$ nano ~/.wegorc
Check Weather Forecast from the Command Line with Wego 2

Add API Key on ~/.wegorc.

Save the file. As you can see on the configuration file, you can change the preferred location, Imperial/metric units, and language.

Your API key is a Free API key and that means you only execute 5 queries per second and limited to 250 queries per day.

Now when we invoke wego command again, you will see the magic. You will see the latest weather forecast of your preferred location, like the screenshot below:

Check Weather Forecast from the Command Line with Wego 3

Invoke the Command again !

As you can see the information includes are temperature, wind direction, wind speed, viewing distance, and precipitation amount and probability.

By default wego just show 3-day weather forecast. So let’s change it to 5 days, you can change it only upto 5 days. Use this command to see 5 day forecast:

$ wego 5

If you want to check weather on other location you can specify the city name as an argument too.

$ wego Tokyo

That’s all for post today about check weather forecast from the command line, If you have question leave it on the comment box below and Thanks for coming !

Leave a Reply

Your email address will not be published. Required fields are marked *