Weather from terminal












57















I want to find the current weather of a particular city or my location from terminal. Is there any command-line weather app?










share|improve this question





























    57















    I want to find the current weather of a particular city or my location from terminal. Is there any command-line weather app?










    share|improve this question



























      57












      57








      57


      23






      I want to find the current weather of a particular city or my location from terminal. Is there any command-line weather app?










      share|improve this question
















      I want to find the current weather of a particular city or my location from terminal. Is there any command-line weather app?







      command-line






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 13 '18 at 14:58









      Zanna

      50.9k13137241




      50.9k13137241










      asked Dec 13 '13 at 16:52









      Avinash RajAvinash Raj

      52.3k41168219




      52.3k41168219






















          12 Answers
          12






          active

          oldest

          votes


















          119














          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:



          Sample output



          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.






          share|improve this answer





















          • 2





            Way much better !

            – Zachary Dahan
            May 13 '16 at 21:33






          • 2





            github.com/schachmat/wego is not bad for the devs between us

            – Timo
            Dec 10 '17 at 19:49



















          17














          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°





          share|improve this answer
























          • But how do I change it to Celcius though

            – dat tutbrus
            Aug 2 '17 at 15:12











          • In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

            – Timo
            Dec 10 '17 at 8:41











          • My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

            – Timo
            Dec 10 '17 at 8:51






          • 1





            Does not work anymore, has Accuweather API changed?

            – Timo
            Dec 31 '18 at 9:58



















          14














          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&amp;deg;C (87&amp;deg;F). Winds 0 kph North
          December 15, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 10 kph NNW
          December 16, 2013: Clear. High 31&amp;deg;C (87&amp;deg;F). Winds 10 kph North
          December 17, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 7 kph ENE
          December 18, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE
          December 19, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE





          share|improve this answer



















          • 1





            Nice with weather forecast. +1 from me.

            – souravc
            Dec 15 '13 at 5:48











          • This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

            – Zahir J
            Dec 27 '16 at 22:12











          • I will update my answer

            – rɑːdʒɑ
            Dec 28 '16 at 2:06











          • Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

            – Ed Neville
            Jan 17 '18 at 20:23











          • When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

            – blalterman
            Jan 10 at 13:47



















          14














          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:



          enter image description here






          share|improve this answer



















          • 4





            This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

            – jschrab
            Feb 24 '16 at 21:56






          • 1





            @jschrab: And you don't need -4 actually. curl wttr.in is enough

            – Igor Chubin
            Feb 24 '16 at 22:25



















          6














          Try using



          telnet rainmaker.wunderground.com





          share|improve this answer



















          • 1





            This seems to be US-only?

            – Vladimir Panteleev
            Sep 27 '16 at 20:11



















          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






          share|improve this answer

































            4














            First you need to install the weather-util package, to do that just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



            sudo apt-get install weather-util


            You’ll need your local weather code.



            After installation you can run weather -i <code>. The code you get from the link above. For a list of available options, you can run weatherWeather info






            share|improve this answer





















            • 1





              it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

              – Avinash Raj
              Dec 13 '13 at 17:13













            • Depending on your location that could be the current info that's available.

              – Mitch
              Dec 13 '13 at 17:15






            • 1





              I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

              – Nicolas
              Mar 22 '16 at 23:05











            • It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

              – Keith Thompson
              Aug 27 '16 at 20:08






            • 1





              That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

              – Keith Thompson
              Jan 31 '17 at 3:08





















            2














            also a program that comes pre-installed with ubuntu called inxi will give you all types of stats on your computer and it does a weather output.



            command: inxi --help



            command: inxi -w



                    Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT


            command: inxi -wxxx



                 Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%

            Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
            Location: city (USA) Altitude: 185 m
            Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT





            share|improve this answer
























            • Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

              – Starbuck
              Nov 28 '18 at 23:35



















            2














            You can compare cities using:



            diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )


            as illustrated in the top-voted answer. wttr.in also makes a great "splash" screen every time you open the terminal. Do this by adding it to your ~/.bashrc file. I've done that to include Weather, Date, Time and Distribution information as detailed in this answer: How can I get this terminal splash screen?



            Bash Splash in Windows 10.png



            Sorry I was in Ubuntu in Windows 10 WSL for Spring 2018 updates when I captured this image. Promise I'll boot back into Ubuntu in Linux soon.






            share|improve this answer































              2














              I have got one more way .



              Open your .bashrc file and then paste this code at the bottom



              test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
              find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;
              head -7 ~/.wttr.in | tail -5
              W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;; head -27 ~/.wttr.in; }


              Save & close your .bashrc file and run the following command to update bash:



              . .bashrc 


              then type W upper case






              share|improve this answer


























              • bash: W: command not found

                – user389450
                Jan 16 '17 at 4:37











              • After edit .bashrc relogin

                – sergkog
                Dec 14 '17 at 20:38











              • You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                – mchid
                Jan 27 at 3:59



















              1














              For even shorter weather output http://weather.tuxnet24.de provides weather data from Yahoo! in text and xml format.



              The filds from the XML can then be obtained with a XML parser like xmllint i.e..



              I wrote a q&d weather-fetch script, wich gets the current temperature and description of weather, then stores a unicode symbol corresponding to the description and outputs it like



              ☂ 6°C



              I regularly update via cronjob and then use the output in my tray status.



              Get your ID at yahoocom/news/weather. Change location to your desired location and look for ID in URL (i.e. if URL is yahoocom/news/weather/germany/north-rhine-westphalia/bielefeld-20066057 the ID is 20066057).



              The XML contains further fields, i.e. forecast data, wind etc. – you can parse them, too, if you want.



              Unfortunatly some weather symbols are not represented in the Ubuntufont… feel free to adjust.



              Here's my script (replace 20066057 with your ID if you don't live in Bielefeld) - depends on bash, curl and xmllint.



              #!/bin/sh
              #☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼

              # write xml to variable
              w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
              # get fields from xml via xmllint | xargs for trimming
              # weather description
              w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
              # temperature | remove spaces from text (°C prepended by space)
              w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
              # further fields not used atm
              # w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
              # w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);

              # set $w_sym according to $w_txt
              if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
              elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
              elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
              elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
              elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
              elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
              elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
              elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
              elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
              elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
              elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
              # if unknown text, set text instead of symbol
              else w_sym=$w_txt;
              fi
              # output <symbol><space><temp-in-°C>
              echo "$w_sym"" ""$w_tpc";





              share|improve this answer


























              • redirection unexpected error

                – Philip Kirkbride
                Feb 16 at 4:09











              • Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                – Philip Kirkbride
                Feb 16 at 4:11



















              0














              Although accuweather curl solution is pretty good I needed something more informational, so I created simple bash script that pulls info for next 4 hrs from weather.com website. As in previous example you have to modify link for your location.



              Example output:
              $ ./getWeather.sh
              Temperature for 1 AM : 65&deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65&deg;
              Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
              Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
              Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;


              Full script is located at:
              https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs






              share|improve this answer























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "89"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f390329%2fweather-from-terminal%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                12 Answers
                12






                active

                oldest

                votes








                12 Answers
                12






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                119














                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:



                Sample output



                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.






                share|improve this answer





















                • 2





                  Way much better !

                  – Zachary Dahan
                  May 13 '16 at 21:33






                • 2





                  github.com/schachmat/wego is not bad for the devs between us

                  – Timo
                  Dec 10 '17 at 19:49
















                119














                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:



                Sample output



                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.






                share|improve this answer





















                • 2





                  Way much better !

                  – Zachary Dahan
                  May 13 '16 at 21:33






                • 2





                  github.com/schachmat/wego is not bad for the devs between us

                  – Timo
                  Dec 10 '17 at 19:49














                119












                119








                119







                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:



                Sample output



                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.






                share|improve this answer















                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:



                Sample output



                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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 13 '18 at 15:46









                Pablo Bianchi

                2,81021534




                2,81021534










                answered Feb 23 '16 at 14:16









                K-FIVEK-FIVE

                1,206262




                1,206262








                • 2





                  Way much better !

                  – Zachary Dahan
                  May 13 '16 at 21:33






                • 2





                  github.com/schachmat/wego is not bad for the devs between us

                  – Timo
                  Dec 10 '17 at 19:49














                • 2





                  Way much better !

                  – Zachary Dahan
                  May 13 '16 at 21:33






                • 2





                  github.com/schachmat/wego is not bad for the devs between us

                  – Timo
                  Dec 10 '17 at 19:49








                2




                2





                Way much better !

                – Zachary Dahan
                May 13 '16 at 21:33





                Way much better !

                – Zachary Dahan
                May 13 '16 at 21:33




                2




                2





                github.com/schachmat/wego is not bad for the devs between us

                – Timo
                Dec 10 '17 at 19:49





                github.com/schachmat/wego is not bad for the devs between us

                – Timo
                Dec 10 '17 at 19:49













                17














                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°





                share|improve this answer
























                • But how do I change it to Celcius though

                  – dat tutbrus
                  Aug 2 '17 at 15:12











                • In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                  – Timo
                  Dec 10 '17 at 8:41











                • My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                  – Timo
                  Dec 10 '17 at 8:51






                • 1





                  Does not work anymore, has Accuweather API changed?

                  – Timo
                  Dec 31 '18 at 9:58
















                17














                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°





                share|improve this answer
























                • But how do I change it to Celcius though

                  – dat tutbrus
                  Aug 2 '17 at 15:12











                • In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                  – Timo
                  Dec 10 '17 at 8:41











                • My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                  – Timo
                  Dec 10 '17 at 8:51






                • 1





                  Does not work anymore, has Accuweather API changed?

                  – Timo
                  Dec 31 '18 at 9:58














                17












                17








                17







                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°





                share|improve this answer













                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°






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 13 '13 at 17:28









                Florian DieschFlorian Diesch

                65.4k16163181




                65.4k16163181













                • But how do I change it to Celcius though

                  – dat tutbrus
                  Aug 2 '17 at 15:12











                • In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                  – Timo
                  Dec 10 '17 at 8:41











                • My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                  – Timo
                  Dec 10 '17 at 8:51






                • 1





                  Does not work anymore, has Accuweather API changed?

                  – Timo
                  Dec 31 '18 at 9:58



















                • But how do I change it to Celcius though

                  – dat tutbrus
                  Aug 2 '17 at 15:12











                • In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                  – Timo
                  Dec 10 '17 at 8:41











                • My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                  – Timo
                  Dec 10 '17 at 8:51






                • 1





                  Does not work anymore, has Accuweather API changed?

                  – Timo
                  Dec 31 '18 at 9:58

















                But how do I change it to Celcius though

                – dat tutbrus
                Aug 2 '17 at 15:12





                But how do I change it to Celcius though

                – dat tutbrus
                Aug 2 '17 at 15:12













                In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                – Timo
                Dec 10 '17 at 8:41





                In the source html, I see acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. Using your code, the awkfield separator is ' ' (space). Is $12 (temperature) the 12th column?

                – Timo
                Dec 10 '17 at 8:41













                My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                – Timo
                Dec 10 '17 at 8:51





                My fault, the awk separator is '. The api uses 2 numbers, the first one is the postleitzahl or zipcode. The second seems to be an api code number

                – Timo
                Dec 10 '17 at 8:51




                1




                1





                Does not work anymore, has Accuweather API changed?

                – Timo
                Dec 31 '18 at 9:58





                Does not work anymore, has Accuweather API changed?

                – Timo
                Dec 31 '18 at 9:58











                14














                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&amp;deg;C (87&amp;deg;F). Winds 0 kph North
                December 15, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 10 kph NNW
                December 16, 2013: Clear. High 31&amp;deg;C (87&amp;deg;F). Winds 10 kph North
                December 17, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 7 kph ENE
                December 18, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE
                December 19, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE





                share|improve this answer



















                • 1





                  Nice with weather forecast. +1 from me.

                  – souravc
                  Dec 15 '13 at 5:48











                • This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                  – Zahir J
                  Dec 27 '16 at 22:12











                • I will update my answer

                  – rɑːdʒɑ
                  Dec 28 '16 at 2:06











                • Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                  – Ed Neville
                  Jan 17 '18 at 20:23











                • When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                  – blalterman
                  Jan 10 at 13:47
















                14














                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&amp;deg;C (87&amp;deg;F). Winds 0 kph North
                December 15, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 10 kph NNW
                December 16, 2013: Clear. High 31&amp;deg;C (87&amp;deg;F). Winds 10 kph North
                December 17, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 7 kph ENE
                December 18, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE
                December 19, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE





                share|improve this answer



















                • 1





                  Nice with weather forecast. +1 from me.

                  – souravc
                  Dec 15 '13 at 5:48











                • This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                  – Zahir J
                  Dec 27 '16 at 22:12











                • I will update my answer

                  – rɑːdʒɑ
                  Dec 28 '16 at 2:06











                • Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                  – Ed Neville
                  Jan 17 '18 at 20:23











                • When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                  – blalterman
                  Jan 10 at 13:47














                14












                14








                14







                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&amp;deg;C (87&amp;deg;F). Winds 0 kph North
                December 15, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 10 kph NNW
                December 16, 2013: Clear. High 31&amp;deg;C (87&amp;deg;F). Winds 10 kph North
                December 17, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 7 kph ENE
                December 18, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE
                December 19, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE





                share|improve this answer













                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&amp;deg;C (87&amp;deg;F). Winds 0 kph North
                December 15, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 10 kph NNW
                December 16, 2013: Clear. High 31&amp;deg;C (87&amp;deg;F). Winds 10 kph North
                December 17, 2013: Clear. High 29&amp;deg;C (84&amp;deg;F). Winds 7 kph ENE
                December 18, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE
                December 19, 2013: Scattered Clouds. High 29&amp;deg;C (84&amp;deg;F). Winds 3 kph ENE






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 15 '13 at 5:04









                rɑːdʒɑrɑːdʒɑ

                58.2k85218302




                58.2k85218302








                • 1





                  Nice with weather forecast. +1 from me.

                  – souravc
                  Dec 15 '13 at 5:48











                • This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                  – Zahir J
                  Dec 27 '16 at 22:12











                • I will update my answer

                  – rɑːdʒɑ
                  Dec 28 '16 at 2:06











                • Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                  – Ed Neville
                  Jan 17 '18 at 20:23











                • When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                  – blalterman
                  Jan 10 at 13:47














                • 1





                  Nice with weather forecast. +1 from me.

                  – souravc
                  Dec 15 '13 at 5:48











                • This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                  – Zahir J
                  Dec 27 '16 at 22:12











                • I will update my answer

                  – rɑːdʒɑ
                  Dec 28 '16 at 2:06











                • Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                  – Ed Neville
                  Jan 17 '18 at 20:23











                • When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                  – blalterman
                  Jan 10 at 13:47








                1




                1





                Nice with weather forecast. +1 from me.

                – souravc
                Dec 15 '13 at 5:48





                Nice with weather forecast. +1 from me.

                – souravc
                Dec 15 '13 at 5:48













                This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                – Zahir J
                Dec 27 '16 at 22:12





                This no longer works, the last dates it shows is from May 2015 (for Cape Town, South Africa at least). Closer examination of the xml output reveals the txt_forecast parent has not been updated since May 2015 while the simpleforecast element seems to have the latest data.

                – Zahir J
                Dec 27 '16 at 22:12













                I will update my answer

                – rɑːdʒɑ
                Dec 28 '16 at 2:06





                I will update my answer

                – rɑːdʒɑ
                Dec 28 '16 at 2:06













                Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                – Ed Neville
                Jan 17 '18 at 20:23





                Replace YOUZIPORLOCATION with $1 if you want weather <location name> to work

                – Ed Neville
                Jan 17 '18 at 20:23













                When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                – blalterman
                Jan 10 at 13:47





                When I replace YOUZIPORLOCATION with $1 and pass 20001 (Washington, DC zipcode), I get lines that look unformatted like Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph. When I use "washington.dc", I get table output May 4, 2015: Clear. High 32&amp;deg;C (89&amp;deg;F). Winds 43 kph East. Any idea why the difference?

                – blalterman
                Jan 10 at 13:47











                14














                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:



                enter image description here






                share|improve this answer



















                • 4





                  This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                  – jschrab
                  Feb 24 '16 at 21:56






                • 1





                  @jschrab: And you don't need -4 actually. curl wttr.in is enough

                  – Igor Chubin
                  Feb 24 '16 at 22:25
















                14














                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:



                enter image description here






                share|improve this answer



















                • 4





                  This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                  – jschrab
                  Feb 24 '16 at 21:56






                • 1





                  @jschrab: And you don't need -4 actually. curl wttr.in is enough

                  – Igor Chubin
                  Feb 24 '16 at 22:25














                14












                14








                14







                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:



                enter image description here






                share|improve this answer













                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:



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 4 '15 at 19:19









                jojojojo

                24135




                24135








                • 4





                  This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                  – jschrab
                  Feb 24 '16 at 21:56






                • 1





                  @jschrab: And you don't need -4 actually. curl wttr.in is enough

                  – Igor Chubin
                  Feb 24 '16 at 22:25














                • 4





                  This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                  – jschrab
                  Feb 24 '16 at 21:56






                • 1





                  @jschrab: And you don't need -4 actually. curl wttr.in is enough

                  – Igor Chubin
                  Feb 24 '16 at 22:25








                4




                4





                This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                – jschrab
                Feb 24 '16 at 21:56





                This is being publicly hosted now - with IP address to region mapping. Try: curl -4 wttr.in

                – jschrab
                Feb 24 '16 at 21:56




                1




                1





                @jschrab: And you don't need -4 actually. curl wttr.in is enough

                – Igor Chubin
                Feb 24 '16 at 22:25





                @jschrab: And you don't need -4 actually. curl wttr.in is enough

                – Igor Chubin
                Feb 24 '16 at 22:25











                6














                Try using



                telnet rainmaker.wunderground.com





                share|improve this answer



















                • 1





                  This seems to be US-only?

                  – Vladimir Panteleev
                  Sep 27 '16 at 20:11
















                6














                Try using



                telnet rainmaker.wunderground.com





                share|improve this answer



















                • 1





                  This seems to be US-only?

                  – Vladimir Panteleev
                  Sep 27 '16 at 20:11














                6












                6








                6







                Try using



                telnet rainmaker.wunderground.com





                share|improve this answer













                Try using



                telnet rainmaker.wunderground.com






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 26 '16 at 2:44







                user389450















                • 1





                  This seems to be US-only?

                  – Vladimir Panteleev
                  Sep 27 '16 at 20:11














                • 1





                  This seems to be US-only?

                  – Vladimir Panteleev
                  Sep 27 '16 at 20:11








                1




                1





                This seems to be US-only?

                – Vladimir Panteleev
                Sep 27 '16 at 20:11





                This seems to be US-only?

                – Vladimir Panteleev
                Sep 27 '16 at 20:11











                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






                share|improve this answer






























                  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






                  share|improve this answer




























                    5












                    5








                    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






                    share|improve this answer















                    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







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 13 '18 at 14:21

























                    answered Jan 13 '18 at 14:15









                    user782355user782355

                    5112




                    5112























                        4














                        First you need to install the weather-util package, to do that just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



                        sudo apt-get install weather-util


                        You’ll need your local weather code.



                        After installation you can run weather -i <code>. The code you get from the link above. For a list of available options, you can run weatherWeather info






                        share|improve this answer





















                        • 1





                          it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                          – Avinash Raj
                          Dec 13 '13 at 17:13













                        • Depending on your location that could be the current info that's available.

                          – Mitch
                          Dec 13 '13 at 17:15






                        • 1





                          I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                          – Nicolas
                          Mar 22 '16 at 23:05











                        • It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                          – Keith Thompson
                          Aug 27 '16 at 20:08






                        • 1





                          That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                          – Keith Thompson
                          Jan 31 '17 at 3:08


















                        4














                        First you need to install the weather-util package, to do that just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



                        sudo apt-get install weather-util


                        You’ll need your local weather code.



                        After installation you can run weather -i <code>. The code you get from the link above. For a list of available options, you can run weatherWeather info






                        share|improve this answer





















                        • 1





                          it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                          – Avinash Raj
                          Dec 13 '13 at 17:13













                        • Depending on your location that could be the current info that's available.

                          – Mitch
                          Dec 13 '13 at 17:15






                        • 1





                          I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                          – Nicolas
                          Mar 22 '16 at 23:05











                        • It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                          – Keith Thompson
                          Aug 27 '16 at 20:08






                        • 1





                          That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                          – Keith Thompson
                          Jan 31 '17 at 3:08
















                        4












                        4








                        4







                        First you need to install the weather-util package, to do that just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



                        sudo apt-get install weather-util


                        You’ll need your local weather code.



                        After installation you can run weather -i <code>. The code you get from the link above. For a list of available options, you can run weatherWeather info






                        share|improve this answer















                        First you need to install the weather-util package, to do that just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



                        sudo apt-get install weather-util


                        You’ll need your local weather code.



                        After installation you can run weather -i <code>. The code you get from the link above. For a list of available options, you can run weatherWeather info







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Dec 13 '13 at 17:25

























                        answered Dec 13 '13 at 16:57









                        MitchMitch

                        84.8k14173230




                        84.8k14173230








                        • 1





                          it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                          – Avinash Raj
                          Dec 13 '13 at 17:13













                        • Depending on your location that could be the current info that's available.

                          – Mitch
                          Dec 13 '13 at 17:15






                        • 1





                          I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                          – Nicolas
                          Mar 22 '16 at 23:05











                        • It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                          – Keith Thompson
                          Aug 27 '16 at 20:08






                        • 1





                          That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                          – Keith Thompson
                          Jan 31 '17 at 3:08
















                        • 1





                          it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                          – Avinash Raj
                          Dec 13 '13 at 17:13













                        • Depending on your location that could be the current info that's available.

                          – Mitch
                          Dec 13 '13 at 17:15






                        • 1





                          I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                          – Nicolas
                          Mar 22 '16 at 23:05











                        • It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                          – Keith Thompson
                          Aug 27 '16 at 20:08






                        • 1





                          That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                          – Keith Thompson
                          Jan 31 '17 at 3:08










                        1




                        1





                        it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                        – Avinash Raj
                        Dec 13 '13 at 17:13







                        it shows Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C).is there no way to know the current weather.

                        – Avinash Raj
                        Dec 13 '13 at 17:13















                        Depending on your location that could be the current info that's available.

                        – Mitch
                        Dec 13 '13 at 17:15





                        Depending on your location that could be the current info that's available.

                        – Mitch
                        Dec 13 '13 at 17:15




                        1




                        1





                        I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                        – Nicolas
                        Mar 22 '16 at 23:05





                        I just tried this and discovered that it is easier to use now: weather YOURLOCATIONNAME It searches for your location then and provides possibly multiple results. From these you can read the station identifier which you can use as argument to fetch your weather informations from

                        – Nicolas
                        Mar 22 '16 at 23:05













                        It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                        – Keith Thompson
                        Aug 27 '16 at 20:08





                        It looks like the service it depends on has been discontinued. I just installed version 2.0, and weather LAX (which should show the weather for Los Angeles International Airport) shows a 404 error for weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT

                        – Keith Thompson
                        Aug 27 '16 at 20:08




                        1




                        1





                        That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                        – Keith Thompson
                        Jan 31 '17 at 3:08







                        That particular data file has moved from here to here. It should be possible to update the data files, changing each occurrence of http://weather.noaa.gov/pub/data to http://tgftp.nws.noaa.gov/data. UPDATE: Looks like they've already fixed it in version 2.1, which you can get from the project site.

                        – Keith Thompson
                        Jan 31 '17 at 3:08













                        2














                        also a program that comes pre-installed with ubuntu called inxi will give you all types of stats on your computer and it does a weather output.



                        command: inxi --help



                        command: inxi -w



                                Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT


                        command: inxi -wxxx



                             Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%

                        Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
                        Location: city (USA) Altitude: 185 m
                        Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT





                        share|improve this answer
























                        • Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                          – Starbuck
                          Nov 28 '18 at 23:35
















                        2














                        also a program that comes pre-installed with ubuntu called inxi will give you all types of stats on your computer and it does a weather output.



                        command: inxi --help



                        command: inxi -w



                                Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT


                        command: inxi -wxxx



                             Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%

                        Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
                        Location: city (USA) Altitude: 185 m
                        Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT





                        share|improve this answer
























                        • Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                          – Starbuck
                          Nov 28 '18 at 23:35














                        2












                        2








                        2







                        also a program that comes pre-installed with ubuntu called inxi will give you all types of stats on your computer and it does a weather output.



                        command: inxi --help



                        command: inxi -w



                                Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT


                        command: inxi -wxxx



                             Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%

                        Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
                        Location: city (USA) Altitude: 185 m
                        Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT





                        share|improve this answer













                        also a program that comes pre-installed with ubuntu called inxi will give you all types of stats on your computer and it does a weather output.



                        command: inxi --help



                        command: inxi -w



                                Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT


                        command: inxi -wxxx



                             Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%

                        Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
                        Location: city (USA) Altitude: 185 m
                        Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered May 13 '18 at 15:56









                        infinitim4tr1xinfinitim4tr1x

                        262




                        262













                        • Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                          – Starbuck
                          Nov 28 '18 at 23:35



















                        • Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                          – Starbuck
                          Nov 28 '18 at 23:35

















                        Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                        – Starbuck
                        Nov 28 '18 at 23:35





                        Seems that inxi is not part of ubuntu, as of 10.04, but can be installed with sudo apt install inxi

                        – Starbuck
                        Nov 28 '18 at 23:35











                        2














                        You can compare cities using:



                        diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )


                        as illustrated in the top-voted answer. wttr.in also makes a great "splash" screen every time you open the terminal. Do this by adding it to your ~/.bashrc file. I've done that to include Weather, Date, Time and Distribution information as detailed in this answer: How can I get this terminal splash screen?



                        Bash Splash in Windows 10.png



                        Sorry I was in Ubuntu in Windows 10 WSL for Spring 2018 updates when I captured this image. Promise I'll boot back into Ubuntu in Linux soon.






                        share|improve this answer




























                          2














                          You can compare cities using:



                          diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )


                          as illustrated in the top-voted answer. wttr.in also makes a great "splash" screen every time you open the terminal. Do this by adding it to your ~/.bashrc file. I've done that to include Weather, Date, Time and Distribution information as detailed in this answer: How can I get this terminal splash screen?



                          Bash Splash in Windows 10.png



                          Sorry I was in Ubuntu in Windows 10 WSL for Spring 2018 updates when I captured this image. Promise I'll boot back into Ubuntu in Linux soon.






                          share|improve this answer


























                            2












                            2








                            2







                            You can compare cities using:



                            diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )


                            as illustrated in the top-voted answer. wttr.in also makes a great "splash" screen every time you open the terminal. Do this by adding it to your ~/.bashrc file. I've done that to include Weather, Date, Time and Distribution information as detailed in this answer: How can I get this terminal splash screen?



                            Bash Splash in Windows 10.png



                            Sorry I was in Ubuntu in Windows 10 WSL for Spring 2018 updates when I captured this image. Promise I'll boot back into Ubuntu in Linux soon.






                            share|improve this answer













                            You can compare cities using:



                            diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )


                            as illustrated in the top-voted answer. wttr.in also makes a great "splash" screen every time you open the terminal. Do this by adding it to your ~/.bashrc file. I've done that to include Weather, Date, Time and Distribution information as detailed in this answer: How can I get this terminal splash screen?



                            Bash Splash in Windows 10.png



                            Sorry I was in Ubuntu in Windows 10 WSL for Spring 2018 updates when I captured this image. Promise I'll boot back into Ubuntu in Linux soon.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered May 13 '18 at 17:23









                            WinEunuuchs2UnixWinEunuuchs2Unix

                            46.1k1189180




                            46.1k1189180























                                2














                                I have got one more way .



                                Open your .bashrc file and then paste this code at the bottom



                                test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
                                find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;
                                head -7 ~/.wttr.in | tail -5
                                W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;; head -27 ~/.wttr.in; }


                                Save & close your .bashrc file and run the following command to update bash:



                                . .bashrc 


                                then type W upper case






                                share|improve this answer


























                                • bash: W: command not found

                                  – user389450
                                  Jan 16 '17 at 4:37











                                • After edit .bashrc relogin

                                  – sergkog
                                  Dec 14 '17 at 20:38











                                • You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                  – mchid
                                  Jan 27 at 3:59
















                                2














                                I have got one more way .



                                Open your .bashrc file and then paste this code at the bottom



                                test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
                                find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;
                                head -7 ~/.wttr.in | tail -5
                                W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;; head -27 ~/.wttr.in; }


                                Save & close your .bashrc file and run the following command to update bash:



                                . .bashrc 


                                then type W upper case






                                share|improve this answer


























                                • bash: W: command not found

                                  – user389450
                                  Jan 16 '17 at 4:37











                                • After edit .bashrc relogin

                                  – sergkog
                                  Dec 14 '17 at 20:38











                                • You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                  – mchid
                                  Jan 27 at 3:59














                                2












                                2








                                2







                                I have got one more way .



                                Open your .bashrc file and then paste this code at the bottom



                                test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
                                find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;
                                head -7 ~/.wttr.in | tail -5
                                W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;; head -27 ~/.wttr.in; }


                                Save & close your .bashrc file and run the following command to update bash:



                                . .bashrc 


                                then type W upper case






                                share|improve this answer















                                I have got one more way .



                                Open your .bashrc file and then paste this code at the bottom



                                test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
                                find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;
                                head -7 ~/.wttr.in | tail -5
                                W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in ;; head -27 ~/.wttr.in; }


                                Save & close your .bashrc file and run the following command to update bash:



                                . .bashrc 


                                then type W upper case







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jan 27 at 3:47









                                mchid

                                23.2k25284




                                23.2k25284










                                answered Oct 31 '16 at 4:38









                                sergkogsergkog

                                212




                                212













                                • bash: W: command not found

                                  – user389450
                                  Jan 16 '17 at 4:37











                                • After edit .bashrc relogin

                                  – sergkog
                                  Dec 14 '17 at 20:38











                                • You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                  – mchid
                                  Jan 27 at 3:59



















                                • bash: W: command not found

                                  – user389450
                                  Jan 16 '17 at 4:37











                                • After edit .bashrc relogin

                                  – sergkog
                                  Dec 14 '17 at 20:38











                                • You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                  – mchid
                                  Jan 27 at 3:59

















                                bash: W: command not found

                                – user389450
                                Jan 16 '17 at 4:37





                                bash: W: command not found

                                – user389450
                                Jan 16 '17 at 4:37













                                After edit .bashrc relogin

                                – sergkog
                                Dec 14 '17 at 20:38





                                After edit .bashrc relogin

                                – sergkog
                                Dec 14 '17 at 20:38













                                You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                – mchid
                                Jan 27 at 3:59





                                You don't have to relogin if you "source" your .bashrc file. You can run: source .bashrc or you can run this instead: . .bashrc

                                – mchid
                                Jan 27 at 3:59











                                1














                                For even shorter weather output http://weather.tuxnet24.de provides weather data from Yahoo! in text and xml format.



                                The filds from the XML can then be obtained with a XML parser like xmllint i.e..



                                I wrote a q&d weather-fetch script, wich gets the current temperature and description of weather, then stores a unicode symbol corresponding to the description and outputs it like



                                ☂ 6°C



                                I regularly update via cronjob and then use the output in my tray status.



                                Get your ID at yahoocom/news/weather. Change location to your desired location and look for ID in URL (i.e. if URL is yahoocom/news/weather/germany/north-rhine-westphalia/bielefeld-20066057 the ID is 20066057).



                                The XML contains further fields, i.e. forecast data, wind etc. – you can parse them, too, if you want.



                                Unfortunatly some weather symbols are not represented in the Ubuntufont… feel free to adjust.



                                Here's my script (replace 20066057 with your ID if you don't live in Bielefeld) - depends on bash, curl and xmllint.



                                #!/bin/sh
                                #☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼

                                # write xml to variable
                                w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
                                # get fields from xml via xmllint | xargs for trimming
                                # weather description
                                w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
                                # temperature | remove spaces from text (°C prepended by space)
                                w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
                                # further fields not used atm
                                # w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
                                # w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);

                                # set $w_sym according to $w_txt
                                if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
                                elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
                                elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
                                elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
                                elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
                                # if unknown text, set text instead of symbol
                                else w_sym=$w_txt;
                                fi
                                # output <symbol><space><temp-in-°C>
                                echo "$w_sym"" ""$w_tpc";





                                share|improve this answer


























                                • redirection unexpected error

                                  – Philip Kirkbride
                                  Feb 16 at 4:09











                                • Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                  – Philip Kirkbride
                                  Feb 16 at 4:11
















                                1














                                For even shorter weather output http://weather.tuxnet24.de provides weather data from Yahoo! in text and xml format.



                                The filds from the XML can then be obtained with a XML parser like xmllint i.e..



                                I wrote a q&d weather-fetch script, wich gets the current temperature and description of weather, then stores a unicode symbol corresponding to the description and outputs it like



                                ☂ 6°C



                                I regularly update via cronjob and then use the output in my tray status.



                                Get your ID at yahoocom/news/weather. Change location to your desired location and look for ID in URL (i.e. if URL is yahoocom/news/weather/germany/north-rhine-westphalia/bielefeld-20066057 the ID is 20066057).



                                The XML contains further fields, i.e. forecast data, wind etc. – you can parse them, too, if you want.



                                Unfortunatly some weather symbols are not represented in the Ubuntufont… feel free to adjust.



                                Here's my script (replace 20066057 with your ID if you don't live in Bielefeld) - depends on bash, curl and xmllint.



                                #!/bin/sh
                                #☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼

                                # write xml to variable
                                w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
                                # get fields from xml via xmllint | xargs for trimming
                                # weather description
                                w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
                                # temperature | remove spaces from text (°C prepended by space)
                                w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
                                # further fields not used atm
                                # w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
                                # w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);

                                # set $w_sym according to $w_txt
                                if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
                                elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
                                elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
                                elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
                                elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
                                # if unknown text, set text instead of symbol
                                else w_sym=$w_txt;
                                fi
                                # output <symbol><space><temp-in-°C>
                                echo "$w_sym"" ""$w_tpc";





                                share|improve this answer


























                                • redirection unexpected error

                                  – Philip Kirkbride
                                  Feb 16 at 4:09











                                • Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                  – Philip Kirkbride
                                  Feb 16 at 4:11














                                1












                                1








                                1







                                For even shorter weather output http://weather.tuxnet24.de provides weather data from Yahoo! in text and xml format.



                                The filds from the XML can then be obtained with a XML parser like xmllint i.e..



                                I wrote a q&d weather-fetch script, wich gets the current temperature and description of weather, then stores a unicode symbol corresponding to the description and outputs it like



                                ☂ 6°C



                                I regularly update via cronjob and then use the output in my tray status.



                                Get your ID at yahoocom/news/weather. Change location to your desired location and look for ID in URL (i.e. if URL is yahoocom/news/weather/germany/north-rhine-westphalia/bielefeld-20066057 the ID is 20066057).



                                The XML contains further fields, i.e. forecast data, wind etc. – you can parse them, too, if you want.



                                Unfortunatly some weather symbols are not represented in the Ubuntufont… feel free to adjust.



                                Here's my script (replace 20066057 with your ID if you don't live in Bielefeld) - depends on bash, curl and xmllint.



                                #!/bin/sh
                                #☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼

                                # write xml to variable
                                w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
                                # get fields from xml via xmllint | xargs for trimming
                                # weather description
                                w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
                                # temperature | remove spaces from text (°C prepended by space)
                                w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
                                # further fields not used atm
                                # w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
                                # w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);

                                # set $w_sym according to $w_txt
                                if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
                                elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
                                elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
                                elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
                                elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
                                # if unknown text, set text instead of symbol
                                else w_sym=$w_txt;
                                fi
                                # output <symbol><space><temp-in-°C>
                                echo "$w_sym"" ""$w_tpc";





                                share|improve this answer















                                For even shorter weather output http://weather.tuxnet24.de provides weather data from Yahoo! in text and xml format.



                                The filds from the XML can then be obtained with a XML parser like xmllint i.e..



                                I wrote a q&d weather-fetch script, wich gets the current temperature and description of weather, then stores a unicode symbol corresponding to the description and outputs it like



                                ☂ 6°C



                                I regularly update via cronjob and then use the output in my tray status.



                                Get your ID at yahoocom/news/weather. Change location to your desired location and look for ID in URL (i.e. if URL is yahoocom/news/weather/germany/north-rhine-westphalia/bielefeld-20066057 the ID is 20066057).



                                The XML contains further fields, i.e. forecast data, wind etc. – you can parse them, too, if you want.



                                Unfortunatly some weather symbols are not represented in the Ubuntufont… feel free to adjust.



                                Here's my script (replace 20066057 with your ID if you don't live in Bielefeld) - depends on bash, curl and xmllint.



                                #!/bin/sh
                                #☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼

                                # write xml to variable
                                w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
                                # get fields from xml via xmllint | xargs for trimming
                                # weather description
                                w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
                                # temperature | remove spaces from text (°C prepended by space)
                                w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
                                # further fields not used atm
                                # w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
                                # w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);

                                # set $w_sym according to $w_txt
                                if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
                                elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
                                elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
                                elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
                                elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
                                elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
                                elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
                                elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
                                # if unknown text, set text instead of symbol
                                else w_sym=$w_txt;
                                fi
                                # output <symbol><space><temp-in-°C>
                                echo "$w_sym"" ""$w_tpc";






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jul 25 '18 at 1:34









                                Alexx Roche

                                1936




                                1936










                                answered Apr 19 '17 at 15:22









                                kai-djkai-dj

                                23827




                                23827













                                • redirection unexpected error

                                  – Philip Kirkbride
                                  Feb 16 at 4:09











                                • Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                  – Philip Kirkbride
                                  Feb 16 at 4:11



















                                • redirection unexpected error

                                  – Philip Kirkbride
                                  Feb 16 at 4:09











                                • Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                  – Philip Kirkbride
                                  Feb 16 at 4:11

















                                redirection unexpected error

                                – Philip Kirkbride
                                Feb 16 at 4:09





                                redirection unexpected error

                                – Philip Kirkbride
                                Feb 16 at 4:09













                                Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                – Philip Kirkbride
                                Feb 16 at 4:11





                                Switching shebang to #!/usr/bin/env bash fixed for me, Ubuntu 18.04

                                – Philip Kirkbride
                                Feb 16 at 4:11











                                0














                                Although accuweather curl solution is pretty good I needed something more informational, so I created simple bash script that pulls info for next 4 hrs from weather.com website. As in previous example you have to modify link for your location.



                                Example output:
                                $ ./getWeather.sh
                                Temperature for 1 AM : 65&deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65&deg;
                                Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
                                Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
                                Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;


                                Full script is located at:
                                https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs






                                share|improve this answer




























                                  0














                                  Although accuweather curl solution is pretty good I needed something more informational, so I created simple bash script that pulls info for next 4 hrs from weather.com website. As in previous example you have to modify link for your location.



                                  Example output:
                                  $ ./getWeather.sh
                                  Temperature for 1 AM : 65&deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65&deg;
                                  Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
                                  Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
                                  Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;


                                  Full script is located at:
                                  https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs






                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    Although accuweather curl solution is pretty good I needed something more informational, so I created simple bash script that pulls info for next 4 hrs from weather.com website. As in previous example you have to modify link for your location.



                                    Example output:
                                    $ ./getWeather.sh
                                    Temperature for 1 AM : 65&deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65&deg;
                                    Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
                                    Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
                                    Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;


                                    Full script is located at:
                                    https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs






                                    share|improve this answer













                                    Although accuweather curl solution is pretty good I needed something more informational, so I created simple bash script that pulls info for next 4 hrs from weather.com website. As in previous example you have to modify link for your location.



                                    Example output:
                                    $ ./getWeather.sh
                                    Temperature for 1 AM : 65&deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65&deg;
                                    Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
                                    Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
                                    Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;


                                    Full script is located at:
                                    https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jul 2 '14 at 7:02









                                    wozoopawozoopa

                                    1




                                    1






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Ask Ubuntu!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f390329%2fweather-from-terminal%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Human spaceflight

                                        Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                                        File:DeusFollowingSea.jpg