Linux基础-文件下载命令

文件下载命令

wget //文件下载
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1317 Feb 17 19:25 anaconda-ks.cfg
[root@localhost ~]# wget www.baidu.com
--2019-02-17 19:55:17-- http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 61.135.169.125, 61.135.169.121
Connecting to www.baidu.com (www.baidu.com)|61.135.169.125|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html’

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

2019-02-17 19:55:17 (173 MB/s) - ‘index.html’ saved [2381/2381]

[root@localhost ~]# ll
total 8
-rw-------. 1 root root 1317 Feb 17 19:25 anaconda-ks.cfg
-rw-r--r-- 1 root root 2381 Jan 23 2017 index.html

-O // 指定存放路径,更改文件名称

[root@localhost ~]# ll ssx-test/
total 0
[root@localhost ~]# wget -O ./ssx-test/index-test.html wwww.baidu.com
--2019-02-17 19:59:28-- http://wwww.baidu.com/
Resolving wwww.baidu.com (wwww.baidu.com)... 123.125.114.144
Connecting to wwww.baidu.com (wwww.baidu.com)|123.125.114.144|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.baidu.com/ [following]
--2019-02-17 19:59:29-- 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: 2381 (2.3K) [text/html]
Saving to: ‘./ssx-test/index-test.html’

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

2019-02-17 19:59:29 (233 MB/s) - ‘./ssx-test/index-test.html’ saved [2381/2381]

[root@localhost ~]# ll ssx-test/
total 4
-rw-r--r-- 1 root root 2381 Jan 23 2017 index-test.html
[root@localhost ~]#

-q // 安静下载(关闭wget输出)

[root@localhost ~]# ll ssx-test/
total 0
[root@localhost ~]# wget -O ./ssx-test/index-test.html wwww.baidu.com -q
[root@localhost ~]# ll ssx-test/
total 4
-rw-r--r-- 1 root root 2381 Jan 23 2017 index-test.html
[root@localhost ~]#

-T -- 超时时间
--spider -- 网络爬虫

wget --spider -q -T 10 -t 3 http://www.baidu.com

curl
-o -- 指定存放路径,更改文件名称

猜你喜欢

转载自www.cnblogs.com/s-sx/p/11840116.html