Home Command line fun How To Check Weather Details From Command Line In Linux
Check Weather Details From Command Line In Linux

How To Check Weather Details From Command Line In Linux

By sk
1402 Views

Have you ever wondered how to find the weather details of your home town from command line in Linux without installing any additional software/applications? No? Well, It is easier than you think! You don't have to install any additional utilities. Just use the'curl' command, which is installed by default in most Linux and Unix distributions, to display the weather details right from the Terminal itself.

If Curl is not installed, you can install it as shown below depending upon the Linux distribution you use.

On Arch Linux and its derivatives:

$ sudo pacman -S curl

On Debian / Ubuntu / Linux Mint:

$ sudo apt-get install curl

On RHEL / CentOS / Fedora:

$ sudo yum install curl

Or,

$ sudo dnf install curl

On SUSE/openSUSE:

$ sudo zypper in curl

Check Weather Details From Command Line In Linux and Unix

Now, let us see how to check weather details from command line using wttr.in utility and curl command. The wttr.in is a web front-end for a utility called Wego. Wego is a command line utility used to display the weather details of given location. Since wttr.in is a web-based utility, we don't need to install it or any other additional utilities. We can get the weather details using wttr.in and curl either from command line or from a web browser in no time.

Using wttr.in utility, we can display weather details,

  • of the current location,
  • of a particular location,
  • of a geographical location,
  • using domain name or IP address,
  • using Zip code,
  • using Airport code,
  • of moon phase.

Let us see one by one.

Display weather details of current location

Open up your Terminal and run:

$ curl wttr.in

The above command will display the weather details of your current location based on your IP address.

Sample output:

Check weather details of your current location

Check weather details of your current location

Display weather details of a particular location

You can even get a particular region weather details. For example, to display the weather details of Erode, a small district in Tamilnadu state, India, run:

$ curl wttr.in/erode

Replace "Erode" with your home town name to get the weather details. This command should work on almost all Linux and Unix operating systems.

Sample output:

Check weather details of a specific location

Check weather details of a specific location

Display weather details for a geographical location

Some times you might want to know the weather details for a geographical location (for example mountain name, monument, or some special location) other than your town or a city. It is also possible. Say you want to display the weather details of a location where Tajmahal is located, just add the tilde symbol ~ before the name like below.

$ curl wttr.in/~Tajmahal

Sample output:

Weather details in a specific geographical location

How about the weather details in Everest? Just run:

$ curl wttr.in/~Everest

Display weather details using domain name or IP address

You can also use domain name prefixed with '@' as a location specificator.

$ curl wttr.in/@ostechnix.com

Sample output:

weather details using domain name

As you see in the above output, ostechnix.com is located in Brea city, United States of America, hence the above command displays weather details of Brea city. You can also use IP address instead of domain name.

Display weather details using Airport code

I know a particular Airport code. Can I able to get the weather details of that region? Yes!! For example, New Delhi Indira Gandhi International Airport code is DEL.

To display the weather details, just run:

$ curl wttr.in/DEL

Sample output:

Weather details using Airport code

Display weather details using Zipcode

It is also possible to get weather details if you know any region's zipcode. For example, New York are a code is 10001. So, just run the following command to display the weather information of New York city.

$ curl wttr.in/10001

Weather details using Zip code

Display weather details in a web browser

Can I get the same details in a web browser? Of course, yes! Open up your web browser, and navigate to http://wttr.in/ in the address bar.

Display Weather details in Web browser

The developer has added a new feature to display the phase of moon.

$ curl wttr.in/moon

Or,

$ curl wttr.in/[email protected]

Change Weather units

By default the USCS units (United States Customary System Units) are used for the queries from the USA and the metric system for the rest of the world. You can, however, change Weather units by adding ?u or ?m to a URL like below:

$ curl wttr.in/Chennai?u
$ curl wttr.in/Chennai?m

To display the help section of wttr.in utility, run:

$ curl wttr.in/:help

And, that's all for now. This is one of the easiest method ever I have found to display the weather details of any location. Have you tried this utility? What do you think about it? Do you know any other alternatives? Feel free to let us know in the comment section below.

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

3 comments

ragaey M. Ragaa December 27, 2018 - 3:29 am

This is amazing webstie

Reply
gian gelardi May 18, 2019 - 4:37 am

I’ve tried various Gnome weather apps and whathaveyous, but this? This I like, it actually works as advertised and no registering to get a key.

Doesn’t get much better.

Reply
Juan December 21, 2019 - 10:24 am

Excellent utility! Thank you very much!

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More