Weather from terminal
Solution 1:
Simply enter the following in a terminal:
curl wttr.in
And will get your location from /etc/timezone
. Otherwise curl wttr.in/your_location
. For example, for Tehran:
curl wttr.in/tehran
Which gives you:
You can also compare two cities:
diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )
Source code of developer is available on Github.
Solution 2:
Search for your city at http://www.accuweather.com and replace the URL in the following script with the URL for your city:
#!/bin/sh
URL='http://www.accuweather.com/en/de/berlin/10178/weather-forecast/178087'
wget -q -O- "$URL" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $2": "$16", "$12"°" }'| head -1
Sample output:
Berlin, Germany: Foggy, 1°
Solution 3:
Here's a great semi-graphical command line utility written in Go:
https://github.com/schachmat/wego/
You'll need to install Go and setup some API stuff, but the instructions are there. Here's a sample pic:
Solution 4:
I have got one more way .
Open your .bashrc
file and then paste this code at the bottom
weather(){ curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';}
Then save & close your .bashrc
file.
now type bash
to update the file.
then type
weather <location name>
for example
august@august-OEM:~$ weather guntur
December 14, 2013: Clear. High 31&deg;C (87&deg;F). Winds 0 kph North
December 15, 2013: Clear. High 29&deg;C (84&deg;F). Winds 10 kph NNW
December 16, 2013: Clear. High 31&deg;C (87&deg;F). Winds 10 kph North
December 17, 2013: Clear. High 29&deg;C (84&deg;F). Winds 7 kph ENE
December 18, 2013: Scattered Clouds. High 29&deg;C (84&deg;F). Winds 3 kph ENE
December 19, 2013: Scattered Clouds. High 29&deg;C (84&deg;F). Winds 3 kph ENE
Solution 5:
ansiweather
AnsiWeather is a Shell script for displaying the current weather conditions in your terminal, with support for ANSI colors and Unicode symbols. Weather data comes from the OpenWeatherMap free weather API.
sudo apt-get install ansiweather
ansiweather -l London,GB -f 3
London forecast => Sat Jan 13: 7/2 °C ☔ - Sun Jan 14: 4/1 °C ☔ - Mon Jan 15: 9/6 °C ☔
https://github.com/fcambus/ansiweather