Posted on
Software

wttr.in: Weather forecast in the terminal

Author
  • User
    Linux Bash
    Posts by this author
    Posts by this author

wttr.in: Checking Weather Forecasts Directly from Your Linux Terminal

Are you a weather enthusiast or someone who just needs quick weather updates without leaving your terminal? If so, wttr.in is an excellent tool for you. This service allows you to fetch weather forecasts right from your command line, using curl or wget to make it work. It's simple, efficient, and perfect for server administrators, developers, or any Linux enthusiast who prefers the terminal to graphical apps.

What is wttr.in?

wttr.in is a web service that provides a console-oriented weather forecast for almost any city in the world. The service is based on wttr.in/WeGo weather backend, which aggregates data from various meteorological services and presents it in a visually appealing form in the terminal.

Features of wttr.in

  • Weather forecast for specific locations globally.

  • Support for multiple units of measurement.

  • Displays weather forecasts in a beautifully formatted ASCII art style.

  • Ability to integrate into shell scripts or system commands.

Installation and Usage

wttr.in itself doesn't require any form of "installation" per se, as it operates over the network using tools like curl or wget. However, ensuring that these tools are installed on your system is necessary. Below are installation instructions for common Linux distributions.

Debian/Ubuntu (using APT)

If you're using a Debian-based distribution like Ubuntu, use the following commands to ensure curl or wget are installed:

sudo apt update
sudo apt install curl

Or for wget:

sudo apt install wget

Fedora (using DNF)

For Fedora or other DNF-based distributions, you can install curl or wget using:

sudo dnf install curl

Or:

sudo dnf install wget

openSUSE (using Zypper)

In openSUSE, you can install curl or wget using zypper:

sudo zypper install curl

Or:

sudo zypper install wget

Checking the Weather with wttr.in

With curl or wget installed, you can now fetch weather updates directly from your terminal. The basic command is:

curl wttr.in

This command will display the weather forecast for your current location based on your IP address. If you want to check the weather for a specific location, simply add the location after wttr.in/. For example:

curl wttr.in/London

To check the weather forecast. Trying another city? Just replace "London" with your desired city's name.

Advanced Usage

wttr.in offers several options to customise the output according to your needs:

  • Format: You can specify the output format using ?format=. For example:

    curl wttr.in/London?format=3
    

    This will show a brief weather condition and temperature.

  • Different Units: To see the temperature in Fahrenheit, use ?u:

    curl wttr.in/London?u
    
  • Moon Phases: You can also check the moon phases:

    curl wttr.in/Moon
    

These examples are just the tip of the iceberg. wttr.inis quite flexible and capable of much more, including integration with conky, use in scripts, setting aliases for quick checks, and so much more.

Conclusion

wttr.in is a fantastic resource for anyone who needs a quick, concise weather outlook without leaving their terminal environment. It's particularly useful for scripting, adding weather info to your status bar, or just getting the forecast without any fuss. Give wttr.in a try; it might just rain down a whole new level of productivity for your command line adventures!