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
- [01] curl
curlInitiates a network request to fetch data from the specified URL. - [02] curl
-sSilent mode. Suppresses the progress bar and error messages to keep the terminal output clean. - [03] curl
-H "Accept-Language: en"Sends an HTTP header to request the weather interpretation and text in English. - [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 mmCaveats & 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.