답변:
터미널에 다음을 입력하기 만하면됩니다.
curl wttr.in
에서 위치를 가져옵니다 /etc/timezone. 그렇지 않으면 curl wttr.in/your_location. 예를 들어, 테헤란의 경우 :
curl wttr.in/tehran
어느 것이 당신에게줍니다 :

두 도시를 비교할 수도 있습니다.
diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )
devs우리 사이에 나쁘지 않습니다
http://www.accuweather.com 에서 도시를 검색 하고 다음 스크립트의 URL을 도시의 URL로 바꾸십시오.
#!/bin/sh
URL='http://www.accuweather.com/en/de/berlin/10178/weather-forecast/178087'
wget -q -O- "$URL" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $2": "$16", "$12"°" }'| head -1
샘플 출력 :
Berlin, Germany: Foggy, 1°
acm_RecentLocationsCarousel.push({name:"Berlin, Germany", daypart:'day', href:'/en/de/berlin/10178/weather-forecast/178087', icon:'i-6-l', bg:'c', temp:'0', realfeel:'-6', text:"Mostly cloudy"});. 코드를 사용하면 awk필드 구분 기호는 ''(공백)입니다. 가 $12(온도) 12 열?
awk구분 기호는 '입니다. API는 2 개의 숫자를 사용하며 첫 번째 숫자는 postleitzahl또는 우편 번호입니다. 두 번째는 API 코드 번호 인 것 같습니다
한 가지 더 방법이 있습니다.
.bashrc파일을 열고 맨 아래에이 코드를 붙여 넣습니다
weather(){ curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';}
그런 다음 .bashrc파일을 저장하고 닫습니다 .
이제 bash파일을 업데이트하기 위해 입력 하십시오.
그런 다음 입력
weather <location name>
예를 들어
august@august-OEM:~$ weather guntur
December 14, 2013: Clear. High 31&deg;C (87&deg;F). Winds 0 kph North
December 15, 2013: Clear. High 29&deg;C (84&deg;F). Winds 10 kph NNW
December 16, 2013: Clear. High 31&deg;C (87&deg;F). Winds 10 kph North
December 17, 2013: Clear. High 29&deg;C (84&deg;F). Winds 7 kph ENE
December 18, 2013: Scattered Clouds. High 29&deg;C (84&deg;F). Winds 3 kph ENE
December 19, 2013: Scattered Clouds. High 29&deg;C (84&deg;F). Winds 3 kph ENE
YOUZIPORLOCATION와 $1및 통과 20001(워싱턴 DC의 우편 번호)를, 내가 좋아하는 포맷되지 않은 볼 줄 수 Today: Mostly sunny and breezy. Highs in the upper 30s. Northwest winds 20 to 25 mph with gusts up to 45 mph.내가 사용하는 경우 "washington.dc", 나는 테이블 출력을 얻을를 May 4, 2015: Clear. High 32&deg;C (89&deg;F). Winds 43 kph East. 왜 차이점이 있습니까?
Go로 작성된 훌륭한 세미 그래픽 명령 줄 유틸리티는 다음과 같습니다.
https://github.com/schachmat/wego/
Go를 설치하고 일부 API를 설정해야하지만 지침이 있습니다. 다음은 샘플 사진입니다.

curl wttr.in충분하다
curl wttr.in/Helsinki?m
먼저 weather-util 패키지를 설치해야 합니다. 키보드에서 Ctrl+ Alt+ T를 누르면 터미널이 열립니다. 열리면 아래 명령을 실행하십시오.
sudo apt-get install weather-util
현지 날씨 코드 가 필요합니다 .
설치 후을 실행할 수 있습니다 weather -i <code>. 위 링크에서 얻은 코드. 사용 가능한 옵션 목록을 보려면 날씨 정보를 실행할 수 있습니다weather
Last updated Dec 11, 2013 - 07:00 AM EST / 2013.12.11 1200 UTC Temperature: 86 F (30 C)이 현재 날씨를 알 수있는 방법을 .is는합니다.
weather YOURLOCATIONNAME결과 지금 사용하기가 더 쉽다는 것을 발견했습니다. 위치를 검색하고 여러 결과를 제공합니다. 이것에서 당신은 당신의 날씨 정보를 가져 오기 위해 인수로 사용할 수있는 스테이션 식별자를 읽을 수 있습니다
weather LAX(로스 앤젤레스 국제 공항의 날씨를 표시해야 함) weather.noaa.gov/pub/data/observations/metar/decoded/KNKX.TXT에
http://weather.noaa.gov/pub/data로 변경하여 데이터 파일을 업데이트 할 수 있어야합니다 http://tgftp.nws.noaa.gov/data. 업데이트 : 버전 2.1에서 이미 수정 한 것처럼 보입니다 . 프로젝트 사이트 에서 얻을 수 있습니다 .
ansiweather
AnsiWeather는 ANSI 색상 및 유니 코드 기호를 지원하여 터미널의 현재 날씨 조건을 표시하기위한 셸 스크립트입니다. 날씨 데이터는 OpenWeatherMap 무료 날씨 API에서 가져옵니다.
sudo apt-get install ansiweather
ansiweather -l London,GB -f 3
London forecast => Sat Jan 13: 7/2 °C ☔ - Sun Jan 14: 4/1 °C ☔ - Mon Jan 15: 9/6 °C ☔
또한 inxi라는 우분투와 함께 사전 설치된 프로그램은 컴퓨터에 모든 유형의 통계를 제공하며 날씨 출력을 수행합니다.
명령 : inxi --help
명령 : inxi -w
Conditions: 82 F (28 C) - Clear Time: May 13, 10:52 AM CDT
명령 : inxi -wxxx
Conditions: 82 F (28 C) - Clear Wind: From the SW at 13 MPH Humidity: 60%
Pressure: 29.99 in (1016 mb) Heat Index: 84 F (29 C)
Location: city (USA) Altitude: 185 m
Time: May 13, 10:52 AM CDT (America/Chicago) Observation Time: May 13, 9:54 AM CDT
sudo apt install inxi
inxi사용 가능하지만 유니버스 리포지토리를 먼저 활성화해야합니다.
다음을 사용하여 도시를 비교할 수 있습니다.
diff -Naur <(curl -s http://wttr.in/london ) <(curl -s http://wttr.in/new-york )
최상위 투표 답변에 설명 된대로 wttr.in또한 터미널을 열 때마다 훌륭한 "스플래쉬"화면을 만듭니다. ~/.bashrc파일 에 추가하여이 작업을 수행하십시오 . 이 답변에 자세히 설명 된 날씨, 날짜, 시간 및 분포 정보를 포함 시키 려면이 터미널 스플래시 화면을 어떻게 얻을 수 있습니까?
이 이미지를 캡처 할 때 2018 년 봄용 Windows 10 WSL 업데이트의 우분투에서 죄송합니다. 곧 리눅스에서 우분투로 다시 부팅 할 것을 약속드립니다.
더 짧은 날씨 출력을 위해 http://weather.tuxnet24.de 는 Yahoo! 텍스트와 XML 형식으로.
xmllint와 같은 XML 파서를 사용하여 XML의 fild를 얻을 수 있습니다.
나는 q & d weather-fetch 스크립트를 작성하고 현재 온도와 날씨 설명을 얻은 다음 설명에 해당하는 유니 코드 기호를 저장하고 다음과 같이 출력합니다.
☂ 6 ° C
나는 cronjob을 통해 정기적으로 업데이트 한 다음 트레이 상태에서 출력을 사용합니다.
yahoocom / news / weather에서 신분증을 받으십시오. 위치를 원하는 위치로 변경하고 URL에서 ID를 찾으십시오 (예 : URL이 yahoocom / news / weather / germany / north-rhine-westphalia / bielefeld-20066057 인 경우 ID는 20066057 임).
XML에는 예측 데이터, 바람 등과 같은 추가 필드가 포함되어 있습니다. 원하는 경우 필드를 구문 분석 할 수도 있습니다.
불행히도 일부 날씨 기호는 우분투 글꼴로 표시되지 않습니다 ... 자유롭게 조정하십시오.
여기 내 스크립트가 있습니다 (Bielefeld에 살지 않으면 20066057을 ID로 대체하십시오)-bash, curl 및 xmllint에 따라 다릅니다.
#!/bin/sh
#☁☂☔❄❅❆☃ ☀☁☂⚡⚐☼
# write xml to variable
w_xml=$(curl -Ls "http://weather.tuxnet24.de/?id=20066057&mode=xml");
# get fields from xml via xmllint | xargs for trimming
# weather description
w_txt=$(xmllint --xpath "string(//current_text)" - <<<"$w_xml" | xargs);
# temperature | remove spaces from text (°C prepended by space)
w_tpc=$(xmllint --xpath "string(//current_temp)" - <<<"$w_xml" | xargs); w_tpc=${w_tpc//[[:blank:]]/};
# further fields not used atm
# w_tph=$(xmllint --xpath "string(//current_temp_high)" - <<<"$w_xml" | xargs);
# w_tpl=$(xmllint --xpath "string(//current_temp_low)" - <<<"$w_xml" | xargs);
# set $w_sym according to $w_txt
if [ "$w_txt" == "Sunny" ]; then w_sym="☼";
elif [ "$w_txt" == "Mostly Sunny" ]; then w_sym="☼";
elif [ "$w_txt" == "Showers" ]; then w_sym="☂";
elif [ "$w_txt" == "Clear" ]; then w_sym="☾";
elif [ "$w_txt" == "Thunderstorms" ]; then w_sym="⚡";
elif [ "$w_txt" == "Scattered Thunderstorms" ]; then w_sym="☔";
elif [ "$w_txt" == "Isolated Thundershovers" ]; then w_sym="☔";
elif [ "$w_txt" == "Cloudy" ]; then w_sym="☁";
elif [ "$w_txt" == "Mostly Cloudy" ]; then w_sym="☁";
elif [ "$w_txt" == "Partly Cloudy" ]; then w_sym="☼☁";
elif [ "$w_txt" == "Breezy" ]; then w_sym="⚐";
# if unknown text, set text instead of symbol
else w_sym=$w_txt;
fi
# output <symbol><space><temp-in-°C>
echo "$w_sym"" ""$w_tpc";
#!/usr/bin/env bash나를 위해 shebang을 고정으로 전환 , Ubuntu 18.04
한 가지 더 방법이 있습니다.
.bashrc 파일을 연 다음이 코드를 맨 아래에 붙여 넣으십시오.
test -f ~/.wttr.in || curl -sk wttr.in -o ~/.wttr.in
find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in \;
head -7 ~/.wttr.in | tail -5
W(){ find ~ -maxdepth 1 -name .wttr.in -cmin +5 -exec curl -sk wttr.in -o ~/.wttr.in \;; head -27 ~/.wttr.in; }
.bashrc파일을 저장하고 닫은 후 다음 명령을 실행하여 bash를 업데이트하십시오.
. .bashrc
W대문자 를 입력하십시오
.bashrc파일 을 "소스"하는 경우 다시 로그인 할 필요가 없습니다 . 당신은 실행할 수 있습니다 source .bashrc또는 당신이 대신을 실행할 수 있습니다. .bashrc
Accuweather curl 솔루션은 꽤 좋지만 더 많은 정보가 필요하므로 weather.com 웹 사이트에서 다음 4 시간 동안 정보를 가져 오는 간단한 bash 스크립트를 만들었습니다. 이전 예에서와 같이 위치에 대한 링크를 수정해야합니다.
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;
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.]
사용 방법은 다음과 같습니다.
$ 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.
이 뒤에 이야기 개발자로부터.