Linux Tutorial: how to view weather forecasts under Linux Command lines

Source: Internet
Author: User
Tags install go valid email address

Linux Tutorial: how to view weather forecasts under Linux Command lines

Q: I often view weather forecasts on Linux desktops. However, is there a way to query weather forecasts without using a desktop plug-in or a browser in a terminal environment?

For Linux Desktop Users, there are many ways to obtain weather forecasts, such as using specialized weather applications, desktop plug-ins, or panel applets. However, if your work environment is terminal-based, there are also some methods to obtain the weather in the command line.

One of them is wego, a small program under a terminal. Using the ncurses-based interface, this command line program allows you to view the current weather conditions and subsequent forecasts. It also collects weather forecasts for the next five days using an API for weather forecasting.

 

Install wego in Linux

Installing wego is quite simple. Wego is written in Go. The first step is to install Go. Then install wego.

  1. $ go get github.com/schachmat/wego

Wego will be installed to $ GOPATH/bin, so add $ GOPATH/bin to the $ PATH environment variable.

  1. $ echo'export PATH="$PATH:$GOPATH/bin"'>>~/.bashrc
  2. $ source ~/.bashrc

Now we can start wego directly from the command line.

  1. $ wego

When weg is run for the first time, a configuration file (~/.wegorc), You need to specify a weather API key. You can get a free API key from worldweatheronline.com. Free registration and use. You only need to provide a valid email address.

Your. wegorc configuration file looks like this:

In addition to the API key, you can configure the location where you want to query the weather, the name of the city/country in use, and the language in~/.wegorc. Note that this weather API has a limit: up to 5 queries per second, up to 250 queries per day. When you re-execute the wego command, you will see the latest weather forecast (of course your specific place), as shown in the question map.

The displayed weather information includes: (1) temperature, (2) wind speed and wind direction, (3) visible distance, (4) by default, the weather forecast for three days is displayed. If you want to modify the weather range, you can use the parameter to change the weather range (up to 5 days), for example, to view the weather forecast for 5 days:

  1. $ wego 5

To check the weather in another place, you only need to provide the city name:

  1. $ wego Seattle

 

Problem Solving
  1. The following error may occur:

    1. user:Currentnot implemented on linux/amd64

    This error occurs when you run wego in an environment that does not support the native Go compiler. In this case, you only need to use gccgo -- A Go compiler frontend to compile the program. You can use the following command to complete this step.

    1. $ sudoyum install gcc-go
    2. $ go get-compiler=gccgo github.com/schachmat/wego

Via: http://ask.xmodulo.com/weather-forecasts-command-line-linux.html

Author: Dan Nanni Translator: oska874 Proofreader: wxy

This article was originally compiled by LCTT and launched with the honor of Linux in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.