Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to browse the weather forecast under the Linux command line

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to browse the weather forecast under the Linux command line, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.

Q: I often check the weather forecast on the Linux desktop. However, is there a way to query the weather forecast in a terminal environment without using desktop widgets or browsers?

For Linux desktop users, there are many ways to get weather forecasts, such as using special weather apps, desktop widgets, or panel Mini Program. But if your work environment is terminal-based, there are also some ways to get the weather from the command line.

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

Install wego under Linux

Installing wego is fairly simple. Wego is written in Go, and the next step is to install the Go language. Then install wego.

$go get github.com/schachmat/wego

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

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

Now you can start wego directly from the command line.

$wego

* * each time you run weg, you will generate a configuration file (~ / .wegorc). You need to specify a weather API key. You can get a free API key from worldweatheronline.com. Register and use it free of charge. You only need to provide a valid email address.

Your .wegorc configuration file looks like this:

In addition to API key, you can also configure the place you want to query the weather, the name of the city / country you use, and the language in ~ / .wegorc. Note that the use of API in this weather is limited: up to 5 queries per second and up to 250 queries per day. When you re-execute the wego command, you will see the weather forecast (your designated place, of course), as shown in the picture.

The weather information displayed includes: (1) temperature, (2) wind speed and direction, (3) visual distance, (4) precipitation and precipitation probability. A 3-day weather forecast is displayed by default. If you want to modify it, you can change the weather range (up to 5 days) with parameters, such as to view the weather forecast for 5 days:

$wego 5

If you want to check the weather in another place, just provide the name of the city:

$wego Seattle

Problem solving

You may encounter the following error:

User: Current not implemented on linux/amd64

This error occurs when you run wego in an environment that does not support native Go compilers. In this case you only need to use gccgo, a compiler front end of Go, to compile the program. This can be done with the following command.

$sudo yum install gcc-go$ go get-compiler=gccgo github.com/schachmat/wego Thank you for reading this article carefully. I hope the article "how to browse the weather forecast under the Linux command line" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report