Je veux trouver l'actuel météo d'une ville particulière ou de mon emplacement depuis le terminal. Existe-t-il une application météo en ligne de commande ?
Réponses
Trop de publicités?Vous pouvez comparer les villes en utilisant :
diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )
comme l'illustre la réponse la plus votée. wttr.in
fait également un grand écran d'accueil chaque fois que vous ouvrez le terminal. Pour ce faire, ajoutez-le à votre ~/.bashrc
fichier. Je l'ai fait pour inclure les informations sur la météo, la date, l'heure et la distribution, comme indiqué dans cette réponse : Comment puis-je obtenir cet écran d'accueil du terminal ?
Désolé, j'étais sous Ubuntu dans Windows 10 WSL pour les mises à jour Spring 2018 quand j'ai capturé cette image. Je promets de redémarrer en Ubuntu sous Linux bientôt.
Météogramme de toutes les villes maires du monde
finger city_name@graph.no
$ finger cologne@graph.no
-= Meteogram for germany/north_rhine-westphalia/cologne =-
'C Rain
16
15 ^^^
14 ======^^^ ^^^
13 === ^^^===^^^===
12 =========
11 === ====--
10 ====== ---
9=====| --- 3 mm
8 | | 2 mm
7 | | | | | | | | | | | | | | 1 mm
_08_09_10_11_12_13_14_15_16_17_18 19 20 21 22 23 00 01 02 03 04 05 Hour
SE SE SE SE SE SW SW W W W W SW W W W W W NW NW NW N N Wind dir.
5 5 5 5 4 4 5 6 6 6 5 5 5 4 4 5 5 5 4 3 3 3 Wind(mps)
Legend left axis: - Sunny ^ Scattered = Clouded =V= Thunder # Fog
Legend right axis: | Rain ! Sleet * Snow
[Weather forecast from yr.no, delivered by the Norwegian Meteorological Institute and the NRK.]
Voici comment l'utiliser :
$ finger help@graph.no
yr.no is having technical problems, or you specified an unknown location.
Usage:
* finger <city name>@graph.no (world weather forecast, no spaces)
Example: finger newyork@graph.no
Advanced usage:
* finger o:<city name>@graph.no (a one-line forecast)
Example: finger o:newyork@graph.no
* finger ^<city name>@graph.no (Imperial units)
Example: finger ^newyork@graph.no
* finger <city name>+5@graph.no (forecast from 5 hrs ahead in time (max:26))
Example: finger northpole+5@graph.no
* finger <city name>~160@graph.no (set screen width)
Example: finger southpole~160@graph.no
* finger <city name>%2@graph.no (forecast for every second hour [Norway])
Example: finger oslo%2@graph.no
* finger <post code>@graph.no (norwegian weather forecast)
Example: finger 0458@graph.no
Other:
* finger news@graph.no (latest headlines from NRK)
* finger time@graph.no (server local time)
* finger date@graph.no (server local date)
* finger about@graph.no (contact information)
International names comes from http://fil.nrk.no/yr/viktigestader/verda.txt.
El l'histoire derrière cette du développeur.
J'ai juste créé un point de terminaison rapide qui renvoie la météo, ainsi que d'autres mesures :
curl https://curl-weather.herokuapp.com/
Notez qu'il n'affiche actuellement que la météo pour Londres (UK). Voici le repo Github au cas où vous voudriez cloner ou ouvrir des problèmes : https://github.com/nkhil/weather-script
Bien que la solution curl d'accuweather soit assez bonne, j'avais besoin de quelque chose de plus informatif, j'ai donc créé un simple bash script qui tire les informations pour les 4 prochaines heures du site web weather.com. Comme dans l'exemple précédent, vous devez modifier le lien pour votre emplacement.
Example output:
$ ./getWeather.sh
Temperature for 1 AM : 65°F and outside should be: Partly - Cloudy FEELS LIKE: 65°
Temperature for 2 AM : 65deg;F and outside should be: Partly - Cloudy FEELS LIKE: 65deg;
Temperature for 3 AM : 63deg; and outside should be: Partly - Cloudy FEELS LIKE: 63deg;
Temperature for 4 AM : 62deg; and should be: Mostly - Clear FEELS LIKE: 62deg;
Le script complet se trouve à l'adresse suivante : https://sites.google.com/site/wozoopalinux/home/wzbash001/get-weather-information-from-command-line-for-next-4-hrs
Si vous connaissez les noms des stations OACI et les informations météorologiques METAR d'un aéroport.
sudo apt install metar
et vérifiez votre aéroport préféré pour obtenir les données de https://www.world-airport-codes.com/ Exemple pour l'aéroport international de Tokyo/ Haneda = RJTT
metar -d rjtt
Exemple de sortie
RJTT 302000Z 34009KT 9999 FEW030 BKN050 14/08 Q1025 NOSIG
Station : RJTT
Day : 30
Time : 20:00 UTC
Wind direction: 440 (NNE)
Wind speed : 9 KT
Wind gust : 9 KT
Visibility : 9999 M
Temperature : 14 C
Dewpoint : 8 C
Pressure : 1025 hPa
Clouds : FEW at 3000 ft
BRK at 5000 ft
Phenomena :
Contrairement à weather
commande, cela ne comprend pas le nom des villes ou des pays. Au lieu de cette fonctionnalité, il peut charger plus rapidement et plusieurs endroits à la fois.
- Réponses précédentes
- Plus de réponses