While normal users tend to stay away from the Linux command line for obvious reasons, power users are the complete opposite, which means that they are always looking for good command line alternatives to GUI-based software they use, be it downloading a file from the Internet, sending a tweet, etc.
But did you know you can also check weather information from the Linux command line? It can be done by using the
weather command. In this article, we will discuss the basics of the command along with the features it provides.
weather utility is intended to provide quick access to current weather conditions and forecasts. Presently it is capable of returning data for localities throughout the USA and some select locations globally by retrieving and formatting decoded METARs (Meteorological Aerodrome Reports) from NOAA (the USA National Oceanic and Atmospheric Administration) and forecasts/alerts from NWS (the USA National Weather Service).
Download and Install
Users of a Debian-based Linux distribution like Ubuntu can download and install the
weather command using the following command:
Alternatively, you can also download its source and install it manually.
Here are some examples of how the
weather command can be used:
Get weather information at a particular location
You can check weather at a particular location by passing its name as a command line argument. For example, to get weather information from the city of San Jose (California), run the following command:
Here’s the result:
Also, even if there’s an ambiguity in the name supplied by you, the utility gives you a list of available options to choose from:
Alternatively, you can also use the Federal Information Processing Standard (FIPS) code of a place to get its current weather conditions. For example, to get San Jose’s weather information, you can use its FIPS code 0668000 in the following way:
and its result:
Get local forecast using the -f option
Aside from current weather conditions, you can also get local forecasts using the
-f command line option. Here is an example:
Display information related to specific weather conditions
If you want to only display information related to specific weather conditions like temperature, wind, and more, you can do that using the
--headers command line option. For example, the following command only displays wind related information:
Get weather information at airports
You can check weather at airports using the (International Air Transport Association) IATA code, or the ICAO (International Civil Aviation Organization) code. For this, all you have to do is to run the
weather utility along with an IATA or ICAO code as a command line argument.
For example, here is an example of the
weather command that uses ICAO code to display weather information at New Delhi airport in India:
And the following command uses IATA code to display weather information at Daytona Beach International:
For more options, go through the
weather command’s man page (http://manpages.ubuntu.com/manpages/raring/man1/weather.1.html).
weather command is a useful utility that provides a host of options, and is aimed at power users or those who require such information to be automatically added to their reports, although that doesn’t mean an average user can’t use it.
Have you ever used the
weather command or a similar utility? How was your experience? Share your thoughts in the comments below.
Image credit: Cloud, forecast, grey, rain, sun, weather icon
Our latest tutorials delivered straight to your inbox