Raspberry Pi_Eng_17.4.2 How to Download from Internet with “wget” Command


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  How to Download from Internet with "wget" Command

 

We occasionally download and install programs directly from the Internet. In this case, you can also download the program directly from the web browser, but you can download the necessary program by specifying the URL directly in the Shell Terminal of Raspberry Pi. The command to use in this case is the "wget" command.

 

[Command Format]

wget  [option]   [URL]

 

[Command Overview]

   This downloads the necessary data from the Internet.

   User privilege          -- Normal user.

 

[Detail Description]

   The download program package is stored in the current working directory unless specified otherwise.

 

[Main 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.

 

 

[Used Example]

The following is an example file to download from the Internet:

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

 

This file is an HTML file that describes the Linux command at www.raspberrypi.org as shown below. This example is to download the HTML file, but you can also download the install program in the same way.

 


 

 


 

Run the "wget" command from the Shell Terminal as shown below.

 

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]

 

If you check the data in [File Manager] after completing the above command, you can see that the files are downloaded as below.