Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.



  1. About
  2. License
  3. Prerequisites
  4. Exit status
  5. How to use

1. About

Weather report written in Bash.

bash-weather gets the computer's public IP address through DynDNS and uses geolocation ( to acquire its current location which is used to get weather condition and forecast from OpenWeatherMap.

2. License

This project is licensed under GNU General Public License Version 3+. For the full license, see LICENSE.

3. Prerequisites

  • OpenWeatherMap API key (
  • Bash shell ≥ 4.2.
  • A terminal with a size of at least 80×22 (80 columns, 22 rows).
  • bc basic calculator for floating point arithmetic. Can be found in the bc package on major Linux distributions.
  • curl command-line tool for getting data using HTTP protocol. cURL can be found in the curl package on major Linux distributions.
  • grep command-line tool used for parsing downloaded XML data. grep can be found in the grep package on major Linux distributions.
  • tput for terminal handling. Can be found in different ncurses packages on Linux distributions (see the table below for major distros).
Distrbution Package name
Arch Linux ncurses
Debian ncurses-bin
Fedora ncurses
openSUSE ncurses-utils
Ubuntu ncurses-bin

4. Exit status

  • 0 bash-weather exited successfully.
  • 1 Missing necessary programs to run bash-weather, or wrong command-line arguments.
  • 2 Too small terminal size (< 80×22).
  • 3 Missing OpenWeatherMap API key.

5. How to use

Get bash-weather

First you have to acquire bash-weather:

git clone

Enter bash-weather's directory:

cd bash-weather

Add your OpenWeatherMap API key to the end of the openweathermap.key file, e.g.

# Add your OpenWeatherMap API key below (

Start bash-weather

Use the Bash interpreter to start the script:


Command-line options

bash-weather can be started with the following command line options:

  • -k Specifies OpenWeatherMap API key from the command-line.
  • -h Prints a simple help to the screen, and exits.
  • -t city_name Sets the city for manual weather lookup.
  • -c country_code Sets the country for manual weather lookup.
  • -f Enables colored output.

Note: If the OpenWeatherMap API key is specified from the command-line, it will override the API key set in the openweathermap.key file.


Get the current weather in Las Vegas:

bash -t "Las Vegas" -c US

Note: don't forget to enclose city names that consist of more than one word within quotes.

Get the current weather in London:

bash -t London -c UK

Get the current weather at your current location by specifying the OpenWeatherMap API key from the command-line:

bash -k 0123dummy456key789

Get the current weather in Christchurch, New Zealand with colored output:

bash -c NZ -t Christchurch -f

Note: the terminal emulator must support 16 colors (e.g. xterm, GNOME Terminal, Konsole); displayed colors may vary in different terminal emulators and by custom profile settings.

Keyboard functions

If you downloaded, and started bash-weather then you'll see a screen like this:

 BUDAPEST, HUNGARY _________________                     oo                     
  ___   __  _   _____                       .            **            .        
 |__ \ /_ |(_) / ____|                       *'.         **         .'*         
    ) | | |   | |                             '*o.       **       .o*'          
   / /  | |   | |                               '*'     .''.     '*'            
  / /_  | |   | |____                               .'********'.                
 |____| |_|    \_____|                             o************o               
 wind: 27.7 km/h, SW                     'oooooo' **************** 'oooooo'     
 3 Day Forecast ____________________               '************'               
     Wed         Thu         Fri               .o*'      **      '*o.           
 ___________ ___________ ___________         ,o*'        **        '*o,         
                                           ,o            **            o,       
  Clear Sky   Cloudy      Clear Sky                      oo                     
 min:  13 C        14 C        11 C                   CLEAR SKY                 
 max:  20 C        17 C        18 C                                             
                                                     Change unit: 'c', Quit: 'q'

Note: bash-weather will refresh the current weather and forecast every minute.

Keyboard functions:

  • c Changes the measurement unit (Celsius → Fahrenheit, Fahrenheit → Celsius).
  • q Quits bash-weather.


Weather report written in Bash







No releases published


No packages published