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.
For Graphic Login:
Open the .bashrc file
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.
Make it executable using chmod
Press Ctrl + Alt + F1 and login to see the script working.
Voila :)
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.
You’ll need your local weather code, which you can get from this website.
- $ sudo apt-get install weather-util
For Graphic Login:
Open the .bashrc file
Press Insert, And append the following lines at the end of the file.
- $ sudo vi ~/.bashrc
# Weather InformationWhere CODE is the code of your location, like VIDP is the code of New Delhi in my case.
weather -i CODE
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.
Press Insert and enter the following code, replacing CODE with your local weather code
- $ sudo vi /etc/update-motd.d/98-weather
Press Esc, and :wq to save and exit.#!/bin/sh
echo
weather -i CODE
echo
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 :)