← All one-liners·#061·Network & APIs·self contained·power

Fetch and Display City Weather in Terminal

Retrieves the current weather and forecast for a specific city, formatting it as an ASCII table directly in the terminal.

Setup
  • → curl
Cost per run
Free (wttr.in is a free public service)
The one-liner
$ curl -s -H "Accept-Language: en" "wttr.in/London?0&m"
What each stage does
  1. [01] curlcurl
    Initiates a network request to fetch data from the specified URL.
  2. [02] curl-s
    Silent mode. Suppresses the progress bar and error messages to keep the terminal output clean.
  3. [03] curl-H "Accept-Language: en"
    Sends an HTTP header to request the weather interpretation and text in English.
  4. [04] curl"wttr.in/London?0&m"
    The target API endpoint. 'London' specifies the city, '?0' restricts output to current weather only, and '&m' forces metric units.
Expected output (sample)
Weather report: London

     \  /       Partly cloudy
   _ /"".\._    +15(15) °C
     \_(   ).   ↑ 11 km/h
     /(___(__)  10 km
                0.0 mm
Caveats & tips
  • Footgun: URL encoding is required for cities with spaces (e.g., wttr.in/New+York).
  • Permission/Cost: wttr.in is a free, rate-limited public API; excessive requests from the same IP may be temporarily blocked.