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

Posted: December 21, 2012. At: 4:06 PM. This was 5 years ago. Post ID: 5055

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.

[email protected] ~ $ 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.

[email protected] ~ $ tempfile 
/tmp/filearO2f2
[email protected] ~ $ 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.

[email protected] ~ $ 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: http://fungi.yuggoth.org/weather/.

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

No comments have been made. Use this form to start the conversation :)

Leave a Reply