How to check weather forecasts from the command line on Linux

Question: I often check local weather forecasts on the Linux desktop. However, is there an easy way to access weather forecast information in the terminal environment, where I don't have access to desktop widgets or web browser?

For Linux desktop users, there are many ways to access weather forecasts, e.g., using standalone weather apps, desktop widgets, or panel applets. If your work environment is terminal-based, there are also several ways to access weather forecasts from the command line.

Among them is wego, a cute little weather app for the terminal. Using an ncurses-based fancy interface, this command-line app allows you to see current weather conditions and forecasts at a glance. It retrieves the weather forecasts for the next 5 days via a weather forecast API.

Install Wego on Linux

Installation of wego is pretty simple. wego is written in Go language, thus the first step is to install Go language. After installing Go, proceed to install wego as follows.

$ go get github.com/schachmat/wego

The wego tool will be installed under $GOPATH/bin. So add $GOPATH/bin to your $PATH variable.

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

Now go ahead and invoke wego from the command line.

$ wego

The first time you run wego, it will generate a config file (~/.wegorc), where you need to specify a weather API key.

You can obtain a free API key from worldweatheronline.com. Free sign-up is quick and easy. You only need a valid email address.

Your .wegorc will look like the following.

Other than API key, you can specify in ~/.wegorc your preferred location, use of metric/imperial units, and language.

Note that the weather API is rate-limited; 5 queries per second, and 250 queries per day.

When you invoke wego command again, you will see the latest weather forecast (of your preferred location), shown as follows.

The displayed weather information includes: (1) temperature, (2) wind direction and speed, (3) viewing distance, and (4) precipitation amount and probability.

By default, it will show 3-day weather forecast. To change this behavior, you can supply the number of days (upto five) as an argument. For example, to see 5-day forecast:

$ wego 5

If you want to check the weather of any other location, you can specify the city name.

$ wego Seattle

Troubleshooting

1. You encounter the following error while running wego.

user: Current not implemented on linux/amd64

This error can happen when you run wego on a platform which is not supported by the native Go compiler gc (e.g., Fedora). In that case, you can compile the program using gccgo, a compiler-frontend for Go language. This can be done as follows.

$ sudo yum install gcc-go
$ go get -compiler=gccgo github.com/schachmat/wego
Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

10 thoughts on “How to check weather forecasts from the command line on Linux

      • Actually, ansiweather does:

        $ LANG=C ansiweather -F
        Rosario forecast => Sun Sep 13: 14/10 °C ☀ - Mon Sep 14: 24/10 °C ☀ - Tue Sep 15: 26/14 °C ☁ - Wed Sep 16: 20/11 °C ☔ - Thu Sep 17: 20/11 °C ☀

        • Um, aparently the comment system mangled my posting, those UTF=8 glyphs go one after each temperature, not all together at the beginning of the line.

  1. Dan, you might have mentioned this program in the past, but "weather-util" is my goto command line program for weather stats and forecasts. If you live in the USA, then this is the cat's meow!

    $ weather -f okz025

    gives me a week-long forecast from the National Weather Service (no registration needed) for my zone - you can easily search by city, county, etc to find your nearest reporting station.

    install "weather-util" and "weather-util-data" (2.0-1 currently in the standard Ubuntu repositories) or see http://fungi.yuggoth.org/weather/ for the developer's website.

Leave a comment

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