← 返回命令列表

Linux command

wttr.in 命令

网络

需要网络或远程资源。

常用示例

Get weather for current location

curl wttr.in

Get weather for a specific city

curl wttr.in/[Paris]

Get weather for a landmark

curl "wttr.in/~[Eiffel Tower]"

Get current weather only

curl wttr.in/[London]?0

Get one-line weather summary

curl "wttr.in/[Berlin]?format=3"

Get weather in metric units

curl wttr.in/[NewYork]?m

Get moon phase

curl wttr.in/moon

Get weather as PNG image

curl wttr.in/[Tokyo].png --output weather.png

说明

wttr.in is a console-oriented weather forecast service accessed via HTTP clients like curl, wget, or httpie. It provides weather information in ASCII art format directly in the terminal, requiring no installation. The service supports various location types: city names, 3-letter airport codes, GPS coordinates, area codes, domain names (prefixed with @), and landmarks (prefixed with ~). Without a location, it uses your IP address to determine location. Output can be customized for different use cases: full 3-day forecasts, current conditions only, one-line format for status bars (tmux, shell prompts), or PNG images. The v2 endpoint (v2.wttr.in) provides expanded data including historical information. wttr.in supports multiple languages and both metric and imperial units. The service handles millions of queries daily and is free to use.

参数

?0
Show only current weather (no forecast).
?1
Show current weather and today's forecast.
?2
Show current weather, today's and tomorrow's forecast.
?m
Use metric (SI) units.
?u
Use USCS (US) units.
?n
Narrow version showing only day and night.
?q
Quiet version without "Weather report" header.
?Q
Superquiet version (no "Weather report" text, no city name).
?format=_string_
Custom format for one-line output. Presets: 1-4. Custom: %c (condition), %t (temperature), %w (wind), %h (humidity), %l (location), %m (moon phase).
?T
Disable terminal sequences (for piping).
?F
Do not show the "Follow" line.
?d
Restrict output to standard console font glyphs.
?M
Show wind speed in m/s.
?lang=_code_
Set language (e.g., lang=de for German). Also available as subdomain: fr.wttr.in.
.png
Return weather as PNG image instead of text.

FAQ

What is the wttr.in command used for?

wttr.in is a console-oriented weather forecast service accessed via HTTP clients like curl, wget, or httpie. It provides weather information in ASCII art format directly in the terminal, requiring no installation. The service supports various location types: city names, 3-letter airport codes, GPS coordinates, area codes, domain names (prefixed with @), and landmarks (prefixed with ~). Without a location, it uses your IP address to determine location. Output can be customized for different use cases: full 3-day forecasts, current conditions only, one-line format for status bars (tmux, shell prompts), or PNG images. The v2 endpoint (v2.wttr.in) provides expanded data including historical information. wttr.in supports multiple languages and both metric and imperial units. The service handles millions of queries daily and is free to use.

How do I run a basic wttr.in example?

Run `curl wttr.in` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does ?0 do in wttr.in?

Show only current weather (no forecast).