Posted: . At: 4:06 PM. This was 11 years ago. Post ID: 5055
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

How to get the weather report from the command-line in America with Linux and other cool commands.

This is how to get the weather report for any American zip code with the Linux command-line. Type sudo apt-get install weather-util to install this utility on Linux Mint 14. In this example we are checking New York City.

john@adeptus-mechanicus ~ $ weather 10001
Current conditions at New York City Central Park, NY
Last updated Dec 20, 2012 - 10:51 PM EST / 2012.12.21 0351 UTC
   Temperature: 45.0 F (7.2 C)
   Relative Humidity: 79%
   Wind: from the ENE (070 degrees) at 13 MPH (11 KT) gusting to 16 MPH (14 KT)
   Sky conditions: overcast

To create a tempfile for writing in a safe manner; use the tempfile command. This creates a temporary file in the /tmp directory that you may use for writing temporary data. This is shown in this example below.

john@adeptus-mechanicus ~ $ tempfile 
/tmp/filearO2f2
john@adeptus-mechanicus ~ $ ls -hula /tmp/**2f2
-rw------- 1 john john 0 Dec 21 15:31 /tmp/filearO2f2

To login again on the same terminal; using the Linux login prompt; use the login command. This is shown in this example below. This is pretty cool I guess; you can see the virtual console login in action. This is another cool feature of Linux.

john@adeptus-mechanicus ~ $ sudo login
[sudo] password for john: 
adeptus-mechanicus login: john
Password: 
Last login: Fri Dec 21 15:41:02 EST 2012 on pts/2
Welcome to Linux Mint 14 Nadia (GNU/Linux 3.5.0-17-generic x86_64)
 
Welcome to Linux Mint
 * Documentation:  http://www.linuxmint.com

Getting back to the weather problem; here is another script that will also retrieve weather data: http://linuxshellaccount.blogspot.com.au/2008/09/bash-script-to-get-weather-forecasts.html.

And here is some information about the weather command: https://securitronlinux.com/bejiitaswrath/get-weather-information-from-the-command-line-in-linux/.

Finally another method of retrieving weather data with curl: http://www.h3manth.com/node/173.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.