常見的wget使用參數

wget 是一個互聯網的下載工具,支持http,https和ftp這三個協議

配置舉例

1、直接獲取百度的index.html

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

2、直接獲取百度的index.html後,進行重命名

[root@localhost ~]# wget -O LEWIS.html www.baidu.com

3、下載時限速

[root@localhost ~]# wget --limit-rate=100k www.baidu.com

4、測試是否可以正常方法

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

看見200 OK 表示正常
Spider mode enabled. Check if remote file exists.
--2019-06-17 11:13:12--  http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 61.135.169.121, 61.135.169.125
Connecting to www.baidu.com (www.baidu.com)|61.135.169.121|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 277 [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.

5、如果wget一個網址,文件下載不下來,那麼wget會不斷重試去嘗試下載
下面可以設置重試次數

[root@localhost ~]# wget --tries=3 www.baidu11.com

6、下載和頁面關聯的所有文件

[root@localhost www.163.com]# wget --mirror -p --convert-links -P./test www.163.com

-p後面的 ./test 指把文件都在下載到該目錄中

7、使用ftp來下載文件

[root@localhost lewis]# wget -r --ftp-user=用戶名 --ftp-password=密碼 url

歡迎大家加入劉貝斯老師QQ羣交流:978526953

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章