码迷,mamicode.com
首页 > 系统相关 > 详细

Linux基础-文件下载命令

时间:2019-11-12 10:49:19      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:tor   out   linux基础   pid   anything   host   roo   cep   ted   

文件下载命令

1.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

2.curl
-o -- 指定存放路径,更改文件名称
-I --head Show document info only
-s --silent Silent mode. Don‘t output anything

Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 277
Content-Type: text/html
Date: Tue, 12 Nov 2019 02:23:13 GMT
Etag: "575e1f60-115"
Last-Modified: Mon, 13 Jun 2016 02:50:08 GMT
Pragma: no-cache
Server: bfe/1.0.8.18

[root@wll ~]# curl -I www.baidu.com | grep HTTP
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 277 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 OK
[root@wll ~]# curl -Is www.baidu.com | grep HTTP
HTTP/1.1 200 OK
[root@wll ~]# curl -Is www.baidu.com | grep HTTP | awk ‘{print $2}‘
200
[root@wll ~]# curl -Is www.baidu.com | awk ‘NR==1{print $2}‘
200
[root@wll ~]#

Linux基础-文件下载命令

标签:tor   out   linux基础   pid   anything   host   roo   cep   ted   

原文地址:https://www.cnblogs.com/s-sx/p/11840116.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!