In this tutorial we will show you how you can see the weather and climate forecast without applications from the Linux console.
Step 1: Verify curl
Before starting, we must validate if we have the curl tool installed which by default is enabled. To verify this, we will execute the following command:
The result should be the following:
Step 2: Weather Forecast
To check the time, we will use an open source service called wttr.in which if we execute it directly in a browser will display all the information of the current climate in our city, wind speed, humidity, etc. To run it from the Linux console, in this case in Ubuntu 16.04, we will use the following syntax:
For example, to know the current time in Madrid we will execute:
The result obtained will be the following:
We can see values such as:
- Wind speed
- State of the weather for the next three days
We can specify city and country if we wish, for example:
The result will be:
If we want to obtain the report of more than two towns we can execute one of the following options:
curl wttr.in/Madrid,\ Roma curl wttr.in/Madrid+Roma
If we run the curl wttr.in command without any parameters, it will display the current location according to the configuration of the equipment.
Step 3: Additional Settings
Next, we will see some of the parameters that we can implement with this useful tool.
See only the values of night and noon
For this, it will be necessary to execute the following.
Display a summary of the weather
To obtain a summary display, just execute the following:
Display the results in a different language
Wttr offers us more than ten available languages to visualize the results being the English language the default value; if we want to see the result in Spanish we will execute the following line: