Linux Terminal makes life easy for day to day administration on a Linux Desktop. And if you are a Power user and spend most of the time on the command prompt, you might want to have some dynamic information such as Weather condition available each time you open the Terminal.

Here is a way to get Weather Information in the Linux Terminal both in graphic (gnome, KDE, Unity) and text login (Ctrl + Alt + F1 to F7) modes.

First install the weather-util package from apt repositories.
  • $ sudo apt-get install weather-util
You’ll need your local weather code, which you can get from this website.

For Graphic Login:

Open the .bashrc file
  •  $ sudo vi ~/.bashrc
Press Insert, And append the following lines at the end of the file.

# Weather Information
weather -i CODE 
Where CODE is the code of your location, like VIDP is the code of New Delhi in my case.

Press Esc, and :wq to save and exit the vi editor.

Close the Terminal and reopen, it will display the weather information before the bash prompt.

For Text Login:

You first need to create a script in the appropriate location using vi editor.
  • $  sudo vi /etc/update-motd.d/98-weather
Press Insert and enter the following code, replacing CODE with your local weather code
weather -i CODE
Press Esc, and :wq to save and exit.

Make it executable using chmod
  • sudo chmod +x /etc/update-motd.d/98-weather

Press Ctrl + Alt + F1 and login to see the script working.

Voila :)

, , , , ,

About the Author

Aamir Mustafa is Ubuntubuzz contributor since January 2012. Aamir is Chemical Engineer from New Delhi, India. He have more than 6 years of experience in IT and Software solutions sales. Interested with this author, Contact him trough his social account Facebook , Twitter, Google + and DeviantArt .