Raspberry Pi_Kor_17.4.2 “wget” 명령으로 인터넷에서 download하는 방법


Published Book on Amazon


All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1

All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)

최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


17.4.2  "wget" 명령으로 인터넷에서 download하는 방법

 

우리는 때때로 인터넷에서 프로그램을 직접 download하여 설치하는 경우가 있다. 이때 물론 web browser에서 해당 프로그램을 download할 수도 있지만, Raspberry Pi Shell Terminal에 직접 URL을 지정하여 필요한 프로그램을 download할 수도 있다. 이때 사용하는 명령이 "wget" 명령이다.   

 

[명령 형식]

wget  [option]   [URL]

 

[명령 개요]

    인터넷에서 필요한 자료를 download한다.

    user 권한    -- 일반 user.

 

[상세 설명]

    download 프로그램 package는 특별한 지정이 없으면 현재 작업 directory에 저장된다

 

[주요 option]

--background

Go to background immediately after startup.  If no output file is specified via the -o, output is redirected to wget-log.

--quiet

Turn off Wget's output.

-t number,

--tries=number

Set number of tries to number. Specify 0 or inf for infinite retrying.  The default is to retry 20 times, with the exception of fatal errors like "connection refused" or "not found"  (404), which are not retried.

--show-progress

Force wget to display the progress bar in any verbosity.

-T seconds

--timeout=seconds

Set the network timeout to seconds seconds.  This is equivalent to specifying --dns-timeout, --connect-timeout, and --read-timeout, all at the same time.

--user=user

--password=password

Specify the username user and password password for both FTP and HTTP file retrieval.  These parameters can be overridden using the --ftp-user and --ftp-password options for FTP connections and the --http-user and --http-password options for HTTP connections.

 

[사용 Example]

다음은 인터넷에서 download하고자 하는 파일 사례이다.

    http://www.raspberrypi.org/documentation/linux/usage/commands.md.

 

이 파일은 아래와 같이 www.raspberrypi.org에서 Linux command를 설명하는 HTML 파일이다. 이 사례는 HTML 파일을 download하는 것이지만 설치 프로그램을 download 하는 것도 동일한 방식으로 처리할 수 있다.


 


 

"wget" 명령을 Shell Terminal에서 아래와 같이 실행한다.

 

pi@raspberrypi ~ $ wget http://www.raspberrypi.org/documentation/linux/usage/commands.md

--2015-04-07 02:17:31--  http://www.raspberrypi.org/documentation/linux/usage/commands.md

Resolving www.raspberrypi.org (www.raspberrypi.org)... 93.93.130.214, 93.93.128.211, 93.93.128.230, ...

Connecting to www.raspberrypi.org (www.raspberrypi.org)|93.93.130.214|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: unspecified [text/html]

Saving to: `commands.md'

 

    [  <=>                                    ] 17,842      63.9K/s   in 0.3s

 

2015-04-07 02:17:32 (63.9 KB/s) - `commands.md' saved [17842]

 

위 명령의 실행이 완료된 후 [File Manager]에서 자료를 확인해 보면 아래와 같이 파일들이 download되어 있음을 확인할 수 있다.


 

 


 

Leave a Reply