linux命令——wget

发布时间:2020-06-12 11:46:02 作者:eth10
来源:网络 阅读:563

    wget是大多数linux自带的一个文件下载工具,使用wget可以下载网络上的文件到本地服务器上,在***测试中,wget使用频率还是较高的,通常使用wget从自己的外网主机(不一定就是外网主机,主要是要让***的目标主机能访问的都行)下载相关工具到我们***的服务器上面,从而实施***,多数情况下就是下载webshell、端口转发工具、提权工具等!

    基本使用语法:

wget url    //这个主要是从网络上下载单个文件并保存到当前目录中

    使用这个下载命令后自动以最后一个/后面的内容进行命令,如果有重名的会自动在后面添加.1,.2这类的名字

root@VM-12-155-debian:~/eth20# ls
root@VM-12-155-debian:~/eth20# wget http://www.baidu.com/index.html
--2017-08-23 09:14:46--  http://www.baidu.com/index.html
Resolving www.baidu.com (www.baidu.com)... 220.181.112.244, 220.181.111.188
Connecting to www.baidu.com (www.baidu.com)|220.181.112.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html’
index.html          100%[===================>]   2.33K  --.-KB/s    in 0s
2017-08-23 09:14:46 (324 MB/s) - ‘index.html’ saved [2381/2381]
root@VM-12-155-debian:~/eth20# ls
index.html
root@VM-12-155-debian:~/eth20#

    如果我们需要对下载的文件进行重命名,需要使用-O(不是零,大写的欧)参数!

root@VM-12-155-debian:~/eth20# wget -O baidu.html http://www.baidu.com/index.html
……
root@VM-12-155-debian:~/eth20# ls
baidu.html  index.html
root@VM-12-155-debian:~/eth20#

    有时我们的网络不稳定,会导致下载中断,这是我们需要使用-c参数进行断点续传!

root@VM-12-155-debian:~/eth20# wget -c http://www.baidu.com/index.html
……
root@VM-12-155-debian:~/eth20#

    但是有些时候我们下载的文件很大,然后总是下载中断,这时如果每次都使用-c参数进行断点续传,这是很忧桑的事情,所以我们需要使用-b参数进行后台下载!在***中,由于某些工具的限制,总是会显示网络超时,然后就下载失败了,此时我们就可以使用-b参数进行下载,然后使用cat wget-log来查看下载进度!

root@VM-12-155-debian:~/eth20# wget -b http://www.baidu.com/index.html
Continuing in background, pid 7709.
Output will be written to ‘wget-log’.
root@VM-12-155-debian:~/eth20# cat wget-log
Resolving www.baidu.com (www.baidu.com)... 220.181.112.244, 220.181.111.188
Connecting to www.baidu.com (www.baidu.com)|220.181.112.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html.1’
     0K ..                                                    100%  380M=0s
2017-08-23 09:23:43 (380 MB/s) - ‘index.html.1’ saved [2381/2381]

    另外我们在***测试中,可能获取的命令执行的当前路径不一定就是网站的可访问路径,此时通过其他手段获取到了网站可访问的绝对路径,然后我们就可以使用-P来下载网络文件到指定的目录中了!

root@VM-12-155-debian:~/eth20# wget -P /root/eth20/eth20/  http://www.baidu.com/index.html
--2017-08-23 09:40:42--  http://www.baidu.com/index.html
Resolving www.baidu.com (www.baidu.com)... 14.215.177.37, 14.215.177.38
Connecting to www.baidu.com (www.baidu.com)|14.215.177.37|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘/root/eth20/eth20/index.html’
index.html          100%[===================>]   2.33K  --.-KB/s    in 0s
2017-08-23 09:40:42 (472 MB/s) - ‘/root/eth20/eth20/index.html’ saved [2381/2381]
root@VM-12-155-debian:~/eth20# ls eth20/
index.html
root@VM-12-155-debian:~/eth20#

    不知道为什么,-P和-O同时使用就不成功了,难道是不支持?

推荐阅读:
  1. yum代理和wget代理设置
  2. wget用法是怎样的

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux命令 wget inux

上一篇:nginx ingress的安装配置和使用

下一篇:Java中”==”运算符的使用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》