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
    Conquering Impostor Syndrome

    Two years ago I documented my struggles with Imposter Syndrome and the response was immense.  I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions.  I've even caught myself reading the post...

  • By
    Create Namespaced Classes with MooTools

    MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does.  Many developers create their classes as globals which is generally frowned up.  I mostly disagree with that stance, but each to their own.  In any event...

Incredible Demos

  • By
    CSS Circles

    A while back I shared a clever technique for creating triangles with only CSS. Over the past year, I've found CSS triangles incredibly effective, especially when looking to create tooltips or design elements with a likewise pointer pattern. There's another common shape...

  • By
    MooTools History Plugin

    One of the reasons I love AJAX technology so much is because it allows us to avoid unnecessary page loads.  Why download the header, footer, and other static data multiple times if that specific data never changes?  It's a waste of time, processing, and bandwidth.  Unfortunately...

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!