Thousands of apps and websites allow you to check the weather. Some more accurate than others, but they all ( well 99.9% of them ) have one thing in common. Bloat. They track you and load various of scripts that have nothing to do with you checking what’s the weather going to be like. But they come with a nice UI and it only costs $0.99.
So how to avoid all the unnecessary and potentially harmful bloat? By using free and open source projects that will allow you to check the weather with just one command.
Before we get started, let me an answer a question that some of you might ask. No, you won’t have to type the command in the terminal emulator every single time you want to check the weather. Once you find the command(s) that you’re happy with, just create an alias.
1. Sky – is a simple CLI tool that uses Dark Sky API to give you the forecast for a day or a week, in Celsius or Fahrenheit. The code for Sky is available on Gitlab.
To check weather for your location simply run the following command in a terminal:
- Celsius
- Weather for today –
curl sky.webionite.com/location/t
- Weather for one week –
curl sky.webionite.com/location
- Weather for today –
- Fahrenheit
- Weather for one today –
curl sky.webionite.com/f/location/t
- Weather for week –
curl sky.webionite.com/f/location
- Weather for one today –
NOTE: Replace sky.webionite.com/
with sky.webionite.com/p/
on Windows
2. wttr.in – is a console-oriented weather forecast service that supports various information representation methods like terminal-oriented ANSI-sequences for console HTTP clients (curl, httpie, or wget), HTML for web browsers, or PNG for graphical viewers.
The easiest way to check the weather in your terminal is by typing curl wttr.in
. It will detect your location based on your IP and display a 3-day forecast. However, if you’re using a VPN it won’t work “out of the box”, but you can type curl wttr.in/LOCATION
.
NOTE: in PowerShell run Invoke-RestMethod http://wttr.in
NOTE: if you’re requesting the weather info for a locations like New York City, Los Angeles, Rio de Janeiro etc, the correct command will be curl wttr.in/new+york+city
or curl wttr.in/los+angeles
or curl wttr.in/rio+de+janeiro
etc NOT curl wttr.in/newyorkcity
and so on.
So what’s the difference between sky and wttr.in? Both projects seem to do the same thing.
Frst difference would be that Sky uses Dark Sky API, while wttr.in uses wego. Besides that, while Sky offers your the weather forecast for the day or a week in Celsius and Fahrenheit, wttr.in allows you to:
1. Use 3-letter airport codes in order to get the weather information at a certain airport. For example you can use curl wttr.in/jfk
to get the weather for IATA: jfk, John F. Kennedy International Airport. Here’s a list of airport IATA codes.
2. If you want to get the weather info for a specific location, like a tourist attraction or a mountain or a train station you would use the same command but add ~
before the name of the location. For example, to see what’s the weather like at the Eiffel Tower you would use curl wttr.in/~Eiffel+Tower
3. You can also use IP addresses (direct) or domain names (prefixed with @
) to specify a location. Using the IP or domain name wttr.in will give your the weather for the location of the server.
4. Data-rich output adds a lot of additional weather and atronimical information:
- Temperature, and precepetation changes forecast throughout the days;
- Moonphase for today and the next three days;
- The current weather condition, temperature, humidity, windspeed and direction, pressure;
- Timezone;
- Dawn, sunrise, noon, sunset, dusk time for he selected location;
- Precise geographical coordinates for the selected location.
To get this you have two options:
- For emoji use:
curl v2.wttr.in/Location
orcurl wttr.in/Location?format=v2
- If you prefer Nerd Fonts instead of Emoji, use
curl v2d.wttr.in/Location
. NOTE: usev2d (day)
orv2n (night)
5. wttr.in can also be used to check the phase of the Moon. This example shows how to see the current Moon phase in the full-output mode with curl wttr.in/Moon
. Get the Moon phase for a particular date by adding @YYYY-MM-DD
like curl wttr.in/Moon@2000-12-25
There’s a whole lot more you can do with wttr.in and you can check the source code and more options on Github.