AnsiWeather is a shell script designed to instantly display the current weather condition in the terminal in ANSI format. It’s better than alternatives in that it’s ultra-fast and needs no resources since it doesn’t run continuously and presents the desired forecast instantly. It’s straightforward to use but also offers some options that allow you to customize how it shows the weather forecast.
You can find better-looking solutions, but they’d be more demanding in resources or more complicated in their use. If all you want is an instant, simple way to check the weather, AnsiWeather will be right up your alley. Let’s see how you can use it.
Also read: How to Add Weather Information to System Tray in Ubuntu
Installation
Although AnsiWeather is available in Ubuntu’s default software collection, you won’t find it in the visually-friendly Software Center. To install it, you’ll have to open the terminal and type:
sudo apt install ansiweather
For other distros, you can simply clone the repository:
git clone https://github.com/fcambus/ansiweather.git
and run:
cd ansiweather ./ansiweather
AnsiWeather is a tiny app, so its installation won’t take more than a few seconds.
Basic Usage
Theoretically, the only thing you need to do to see details about the current weather in your location is to run AnsiWeather in your favorite terminal. After its installation, with your terminal on screen, type:
ansiweather
As you can see in the screenshot, AnsiWeather presented me with information about the weather in Rzeszow. Apart from the expected temperature, it also showed the speed of the wind and the levels of humidity and pressure. There was only one tiny problem: I don’t live in Rzeszow. Far from it – literally!
Your Weather
To have AnsiWeather display the weather for your actual location without guessing, you have to input it manually. For this, you’ll have to use the -l
switch, followed by your city/state and country. Since I live in Athens, Greece, I used the following to get the weather for my location:
ansiweather -l Athens,GR
Similarly, someone in London would use:
ansiweather -l London,UK
If there’s no doubt about which country you’re referring to, you can skip stating it altogether and run AnsiWeather as:
ansiweather -l Taiwan
More Switches
Other than including a specific location (with the -l
switch), you can also define the metric system you prefer by using the -u
switch with two possible options: to build on our previous command, it would look like either of the following:
ansiweather -l Athens,GR -u metric
or
ansiweather -l Athens,GR -u imperial
Seeing the weather forecast was mentioned, but up until now, we only saw current weather conditions. To get an actual forecast, you’ll have to use the -f
switch, followed by a number of days. For example:
ansiweather -l Paris,FR -u metric -f 3
The above command shows a three-day weather forecast for Paris, France, using the metric system. Alternatively, you can use a capital -F
as the switch, that shows the forecast for the next five days:
ansiweather -l Paris,FR -u metric -F
Although far from a specialized, graphics-rich weather widget or weather application, AnsiWeather can look somewhat better if you enable its support for symbols. For that, you’ll have to set the -s
switch to true
as follows:
ansiweather -l London,UK -u metric -F -s true
If you’d like, AnsiWeather can tell you the exact time of sunrise and sunset in your location. For that, set the -d
switch to true
:
ansiweather -l London,UK -u metric -s true -d true
Notice, though, that it seems it’s hardcoded not to exceed a specific length of information, so you can’t, for example, ask for the daytime and a five-day forecast at the same time.
Finally, some other switches worth noting are -a
that allows you to toggle ANSI color support, -w
to ask for wind data, -h
for humidity, and -p
for pressure data. All of them demand a “true” or “false,” as we saw for previous options, to set them ON or OFF.
And since it works entirely in the terminal, you can use AnsiWeather as the base for building your own smart scripts. With those, you could, for example, check the forecast for the next day and send an email to yourself if you will need to take your umbrella with you. That’s something maybe we will discuss in another article.
Are you using a different app or solution to check the weather or something like WTTR that combines the terminal with a web-based service? And if yes, which one?
Our latest tutorials delivered straight to your inbox