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
    Welcome to My New Office

    My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...

  • By
    Facebook Open Graph META Tags

    It's no secret that Facebook has become a major traffic driver for all types of websites.  Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly.  And of course there are Facebook "Like" and "Recommend" widgets on every website.  One...

Incredible Demos

  • By
    Morphing Elements Using MooTools and CSS

    Morphing an element between CSS classes is another great trick the MooTools JavaScript library enables you to do. Morphing isn't the most practical use of MooTools, but it's still a trick at your disposal. Step 1: The XHTML The block of content that will change is...

  • By
    JavaScript Speech Recognition

    Speech recognition software is becoming more and more important; it started (for me) with Siri on iOS, then Amazon's Echo, then my new Apple TV, and so on.  Speech recognition is so useful for not just us tech superstars but for people who either want to work "hands...

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!