Get Weather from Command Line

By  on  

There's an awesome script making the rounds on Twitter and I've been as excited as everyone else so I thought I'd show it.  Many of us live eight hours a day within the command line (although I'm not a vim hippie like some of you) so I try to find new ways to accomplish tasks from within iTerm (like getting bitcoin value or stock quotes).  Many of these solutions include using cURL and this awesomeness is no exception!

curl weather

You can get weather information from command line using cURL and wttr.in:

# Allow geolocation
curl -4 wttr.in

# Request a city
curl -4 wttr.in/Madison

wttr.in does well to guess location if one isn't provided so in most cases you wont need to provide your city.

There you go, another awesome way to get the information you need from command line!

Recent Features

  • By
    Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...

  • By
    Animated 3D Flipping Menu with CSS

    CSS animations aren't just for basic fades or sliding elements anymore -- CSS animations are capable of much more.  I've showed you how you can create an exploding logo (applied with JavaScript, but all animation is CSS), an animated Photo Stack, a sweet...

Incredible Demos

  • By
    MooTools Clipboard Plugin

    The ability to place content into a user's clipboard can be extremely convenient for the user. Instead of clicking and dragging down what could be a lengthy document, the user can copy the contents of a specific area by a single click of a mouse.

  • By
    Create a Trailing Mouse Cursor Effect Using MooTools

    Remember the old days of DHTML and effects that were an achievement to create but had absolutely no value? Well, a trailing mouse cursor script is sorta like that. And I'm sorta the type of guy that creates effects just because I can.

Discussion

  1. Jeremy

    Frickin’ genius!

  2. Lis

    This is excellent! As a relative rube when it comes to the command line though, can someone kindly explain the purpose of -4 in the command? I seem to get the same results whether I include it or leave it out.

  3. David

    It looks like iTerm here translates/renders the curl response HTML output? Or curl implicitly does that (if so what version of curl are you using)? Because the raw HTML (unprocessed) does not look as nicely displayed as the screenshot. Only if you render the HTML will it look like that.

  4. Chris

    I created an (OS X only) to automatically show your local weather:

    https://gist.github.com/6343547a0169e9b6167d

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!