Check Weather from terminal in Ubuntu

Published: November 16, 2022

Check Weather from terminal in Ubuntu

In this article, we cover how to check weather from terminal in Ubuntu. If you stay at a place where weather conditions change frequently then it becomes crucial to check weather related data before venturing out or planning our activities. Even if weather looks stable, you never know how fast that would change. So, one must keep a track of weather conditions always.

There are numerous gadgets which can help us track such information. Even in Ubuntu there are GUI applications providing weather related info. But, we were looking for a command-line utility for the same in Ubuntu. And, we found that AnsiWeather was a perfect fit for us.

We have to install a package for AnsiWeather as it isn't installed as default. So, installation steps comes next.

Note: Following operations require superuser privileges. In case you don't have one then, we advise you to contact your System Administrator for assistance.

Install AnsiWeather in Ubuntu

The package is available through standard Ubuntu repository. Therefore, update the repository first to get the latest version of the package. Hence, open a terminal and issue the following -

sudo apt update

Next, to install AnsiWeather -

sudo apt install ansiweather

Use AnsiWeather to get weather data

To get the last recorded weather related information for a location, use the following syntax -

ansiweather -l <location>

For instance, for London -

ansiweather -l London

or, for New York -

ansiweather -l New\ York

We have used a backslash(\) here to escape space.

Besides, we can also get forecast for next 5 days by using -F option -

ansiweather -F -l <location>

Or, for a specific number of days forecast -

ansiweather -f <number-of-days> -l <location>

For instance,

ansiweather -f 7 -l London

Lastly, we can get data in either imperial or metric system. Use -u option and specify the measurement system -

ansiweather -u metric -l <location>

or,

ansiweather -u imperial -l <location>
In conclusion, we have covered how to check weather from terminal in Ubuntu here.