Commands tagged weather (9)

  • Change Seville for your prefered city. Show Sample Output

    nordri · 2016-08-28 09:43:38 10
  • This shell function grabs the weather forecast for the next 24 to 48 hours from Replace <YOURZIPORLOCATION> with your zip code or your "city, state" or "city, country", then calling the function without any arguments returns the weather for that location. Calling the function with a zip code or place name as an argument returns the weather for that location instead of your default. To add a bit of color formatting to the output, use the following instead: weather(){ curl -s "${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "\x1B[0;34m%s\x1B[0m: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';} Requires: perl, curl Show Sample Output

    weather(){ curl -s "${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';}
    eightmillion · 2010-02-10 01:23:39 8
  • Check your local temperature based on geolocation. Show Sample Output

    curl -s$(curl -s$(curl -s | sed -e'1d;3d' -e's/C.*: \(.*\)/\1/' -e's/ /%20/g' -e"s/'/%27/g") | sed 's|.*<t.*f data="\([^"]*\)"/>.*|\1\n|'
    o0110o · 2010-02-14 19:44:54 1
  • Perfect for following Hurricane Irene

    vlc mms://
    andresmh · 2011-08-28 02:24:53 0

  • 0
    curl -s | grep -E 'og:title|og:description' | cut -d\" -f4 | awk '{print $0,"<p>"}' | lynx -stdin -dump
    jc · 2013-08-21 21:43:11 0
  • Just 253 chars of pure UNIX magic, with curl. I created this contrived bash one-liner while building a command-line bash game : Show Sample Output

    curl -s | xargs -n 1 curl -s "$1" | cut -d ',' -f '9 10' | sed 's/,/\&lon=/g' | xargs -n 1 echo "$1" | sed 's/ //g' | xargs -n 1 curl -s $1 | lynx -stdin -dump
    supermoustachu · 2015-02-04 00:47:06 2
  • Will return temperature in Fahrenheit of a location (New York City in example). Uses a Google API. Show Sample Output

    curl -s "" | sed 's|.*<temp_f data="\([^"]*\)"/>.*|\1|'
    matthewbauer · 2010-02-08 23:06:48 2
  • you can use xmlstarlet to parse output instead of perl

    curl -s${@:-<YOURZIPORLOCATION>}|xmlstarlet sel -E utf-8 -t -m //forecast/txt_forecast/forecastday -v fcttext -n
    fanfani · 2010-04-13 22:14:48 0
  • Weather based on your location

    curl -s$(curl -s "$(curl -s" | grep City | sed 's/City: \(.*\)/\1/' | sed 's/ /%20/g' | sed "s/'/%27/g") | sed 's|.*<temp_f data="\([^"]*\)"/>.*|\1\n|'
    matthewbauer · 2010-02-13 21:42:48 8

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

list block devices
Shows all block devices in a tree with descruptions of what they are.

Blink Caps Lock on HDD activity
Some computers these days don't have an HDD activity light, but they still have a useless caps-lock, so why not re-purpose that light to show HDD activity? Requires setleds and dstat and probably needs to run as root.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Tree based ps view "painted" by ccze

Find jpeg images and copy them to a central location
Use if you have pictures all over the place and you want to copy them to a central location Synopsis: Find jpg files translate all file names to lowercase backup existing, don't overwrite, preserve mode ownership and timestamps copy to a central location

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Increase SCT of external USB disk enclosure to one hour.
So I had this 2TB Seagate external disk/USB enclosure which by default would spin-down its internal drive (it enters a standby mode) after four minutes of inactivity.. Spinning-up the inactive drive was an annoying delay when accessing files and also it severely interfered with NFS.. SCT stands for "Standby Condition Timer". To completely disable SCT: $ sdparm --clear STANDBY -6 /dev/sdb To return to original (default) SCT settings: $ sdparm -D -p 0x1a -6 /dev/sdb To verify the settings (before and after): $ sdparm -a /dev/sdb No need for vendor-provided MSWIN tools, etc.

Check reverse DNS
I'm just a simple programmer. I find dig too verbose. host tells me alias(es) and IP address in a quick to grok format with nothing special to remember for input parameters. With thanks to

String to binary
Cool but useless.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: