< willowashmaple.xyz

By Willow (willowashmaple.xyz)

The ultimate weather apps

Aug. 31, 2024 (Updated Oct. 9, 2024)

One of the most fun aspects of being a Linux user is all the cool tricks one can play in the shell (or, command-line interface). Once you get a hang of it, it becomes your second nature like learning a second language. And it's fast! No bloated GUI or slow internet connection to worry about.

How to get weather using a CLI

Your Linux installation (as well as other UNIX-like systems such as FreeBSD and even MacOS) comes with a terminal emulator. If you have a Chromebook, you will need to activate the "Linux development environment" in the settings first, which will automatically install a Debian 12 virtual machine.

A terminal emulator should look like a blank window with a tilde (~) or a dollar sign ($) and a blinking cursor staring at you. If you see a crosshatch (#) instead of a ~ or $, you are inside a "root" shell, which is basically a "God mode." This should not be happening.

Now here's where the fun begins.

Method 1 : weather

The "weather" command displays the current weather observation of a weather station (typically an airport). To use this, simply type "weather -f" and a four-letter (ICAO) airport code.

For example, Portland, Oregon would be:

weather -f kpdx

Other cities in the Portland-Vancouver-Salem region:

Vancouver, WA: kvuo

Kelso/Longview, WA: kkls

Troutdale/Fairview/Gresham: kttd

Hillsboro: khio

Scappoose/Warren/Saint Helens: kspb

Astoria/Warrenton: kast

Tillamook: ktmk

McMinnville: kmmv

Aurora/Wilsonville/Canby: kuao

Salem/Keizer: ksle

Corvallis: kcvo

Cascade Locks: kczk

The Dalles: kdls

Search for other locations

This will pull the latest data from the National Weather Service (for U.S. locations), the Environment and Climate Change Canada (for Canadian locations), or other national counterparts.

Unfortunately, since March of this year when NWS reorganized its forecast zones, weather forecasts are no longer available using this method (other countries did not provide forecasts even before then).

Method 2: wttr.in

This is actually a web-based service but since everything is text-based, you can display weather (current conditions and a 3-day forecast) in a terminal:

Option A: use curl

curl wttr.in/kuao  

Any ICAO code works here as well.

curl wttr.in/yyj

A three-letter IATA code also is acceptable, like YYJ for Victoria, BC.

curl wttr.in/~tualatin  

Also you can use most place names followed by a tilde (~).

Option B: use lynx

Lynx is a text-based web browser.

lynx https://wttr.in/ksle

Method 3: gopher (U.S. only)

Gopher is another text-based content distribution system, predating the invention of the World Wide Web.

gopher gopher://gopher.floodgap.com:70/7/groundhog/us/zipcode

This will open a prompt asking for a U.S. ZIP code. It will then display a weather forecast for that particular city. Alternatively, you can use Lynx to display Gopher content:

lynx gopher://gopher.floodgap.com:70/7/groundhog/us/zipcode

To display the latest National Weather Service forecast for your forecast zone,

gopher gopher://gopher.floodgap.com:70/1/groundhog/us/forecast

or

lynx gopher://gopher.floodgap.com:70/1/groundhog/us/forecast

If they do not work

It is possible that your Linux distribution did not ship with these software packages.

sudo apt update && sudo apt install curl weather-util gopher lynx-cur

This should install all the packages you need and their dependencies, if any.

Method 4: metar

This displays METAR data, including current temperature, humidity, wind, and clouds.

Install "metar" from repo (sudo apt install metar).

Usage (e.g., Salem, Oregon ICAO code KSLE):

metar -d KSLE  

Method 5: ansiweather

This displays a local weather forecast.

Install "ansiweather" from repo (sudo apt install ansiweather).

Usage (e.g., Tualatin, Oregon):

ansiweather -l Tualatin,US -f 3 -u imperial  

"-f 3" means a 3-day forecast, "-u metric" will show Celsius instead of Fahrenheit. If a city name has a space, enter like this (back slash before a space, or it will break):

ansiweather -l Oregon\ City,US -f 3 -u imperial

----

Copyright 2022-2024. Articles on this site may be used freely under the terms of the Cooperative Nonviolent Public License version 7 or the latest, whichever the newer (CNPL v7+). All other uses require the express permission of the author. See the contact page (on Gemini or WWW: willowashmaple.xyz/contact; on Gopher: gopher://willowashmaple.xyz:70/0/willowashmaple/contact) for email and other ways to get in touch.

CNPL

----

return home

headlines

subscribe (rss)

tip jar

https://willowashmaple.goatcounter.com/count?p=/test-noscript#pixel.png