Linux basic commands --- wget download tool

wget

wget is a free download tool, you can download files from a specified URL to the local host. It supports HTTP and FTP protocols, often used to fetch a lot of page file.

Scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.

 

1 , grammar

wget [options]  [path or URL] 

wget price Return Value: 0, normal; 1, general error; 2, parameter error; 3, IO error; 4, network errors; 5, SSL error; 6, username password error; 7, protocol error; 8, the server error.

 

2 , the parameter list

Options

Explanation

-a

The process of instruction execution to the specified file

-A

To download the extension is set to ask Akin, use multiple extensions, divided

-b

The download tasks running in the background

-B

Set basic reference link address

-c

Resume where it left off

-C

Open or close the data caching server, the default on

-d

Debug mode

-D

Set to accept the domain name, the use of multiple domain names, separate

-e

Pick wget command after the execution of

-F

The input file as HTML format

-h

Displays help information

-i

Get URL from the specified file

-l

Set accepted directory

-L

Download the associated connection          

-P

Specify the file storage directory

-r

Download all the files in the specified directory recursively

-R

Set file types to exclude downloaded

-nc

When the file exists, does not cover

-nd

All files are downloaded to the current directory

-nv

Download, update and display only error messages

-q

Silent mode

-nh

Do not look up hostnames

-v

Show execution

-V

Displays version information

 

3 , examples

1 ) Download

[root@localhost ~]# wget -v www.baidu.com

--2018-10-03 10:06:32--  http://www.baidu.com/

正在解析主机 www.baidu.com... 111.13.100.91, 111.13.100.92

正在连接www.baidu.com|111.13.100.91|:80... 已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:2381 (2.3K) [text/html]

正在保存至: “index.html”

 

100%[======================================>] 2,381       --.-K/s   in 0s     

 

2018-10-03 10:06:42 (157 MB/s) - 已保存“index.html” [2381/2381])

 

You have new mail in /var/spool/mail/root

2 ) Download, designated storage directory

[root@localhost ~]# wget -P /weijie/ -r -l 2 www.baidu.com        //指定存放目录,递归下载2层目录

--2018-10-03 10:09:28--  http://www.baidu.com/

正在解析主机 www.baidu.com... 111.13.100.92, 111.13.100.91

正在连接www.baidu.com|111.13.100.92|:80... 已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:2381 (2.3K) [text/html]

正在保存至: “/weijie/www.baidu.com/index.html”

 

100%[======================================>] 2,381       --.-K/s   in 0.01s  

 

2018-10-03 10:09:29 (197 KB/s) - 已保存“/weijie/www.baidu.com/index.html” [2381/2381])

 

正在载入 robots.txt;请忽略错误消息。

--2018-10-03 10:09:29-- http://www.baidu.com/robots.txt

正在连接www.baidu.com|111.13.100.92|:80... 已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:2754 (2.7K) [text/plain]

正在保存至: “/weijie/www.baidu.com/robots.txt”

 

100%[======================================>] 2,754       --.-K/s   in 0.05s  

 

2018-10-03 10:09:29 (56.6 KB/s) - 已保存“/weijie/www.baidu.com/robots.txt” [2754/2754])

 

下载完毕 --2018-10-03 10:09:29--

下载了:个文件,0.06s (84.5 KB/s) 中的 5.0K

[root@localhost ~]# ls /weijie/www.baidu.com/              //查看下载内容

index.html  robots.txt

 

      Made a study of the Linux platform, now came up with a prototype, you can use and reference

      链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk 

081634m8n8t2tmz2te95w5.gif


Guess you like

Origin blog.51cto.com/9888479/2412162