1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.zh/common/wget.md

38 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2019-08-15 08:45:57 +08:00
# wget
> 从网络上下载文件。
2019-08-15 08:45:57 +08:00
> 支持 HTTP, HTTPS, 和 FTP.
> 更多信息:<https://www.gnu.org/software/wget>.
2019-08-15 08:45:57 +08:00
- 将该 URL 的内容下载到文件中(在这个例子中文件名为 "foo"):
2019-08-15 08:45:57 +08:00
`wget {{https://example.com/foo}}`
- 将该 URL 的内容下载到文件中(在这个例子中文件名为 "bar"):
2019-08-15 08:45:57 +08:00
`wget {{[-O|--output-document]}} {{bar}} {{https://example.com/foo}}`
2019-08-15 08:45:57 +08:00
- 以每三秒一个请求的速度下载一个网页和其所有资源(脚本,样式表,图片等等):
2019-08-15 08:45:57 +08:00
`wget {{[-p|--page-requisites]}} {{[-k|--convert-links]}} {{[-w|--wait]}} 3 {{https://example.com/somepage.html}}`
2019-08-15 08:45:57 +08:00
- 从一个目录中下载所有列出的文件和其所有子文件夹(不下载内嵌网页):
2019-08-15 08:45:57 +08:00
`wget {{[-m|--mirror]}} {{[-np|--no-parent]}} {{https://example.com/somepath/}}`
2019-08-15 08:45:57 +08:00
- 限制下载速度和重试次数:
2019-08-15 08:45:57 +08:00
`wget --limit-rate {{300k}} {{[-t|--tries]}} {{100}} {{https://example.com/somepath/}}`
2019-08-15 08:45:57 +08:00
- 使用基本授权来从 HTTP/FTP 服务器中下载文件:
2019-08-15 08:45:57 +08:00
`wget --user {{username}} --password {{password}} {{https://example.com}}`
2019-08-15 08:45:57 +08:00
- 继续一个未完成的下载任务:
2019-08-15 08:45:57 +08:00
`wget {{[-c|--continue]}} {{https://example.com}}`
2019-08-15 08:45:57 +08:00
- 将指定文件中所有列出的 URL 下载到一个目录中:
2019-08-15 08:45:57 +08:00
`wget {{[-P|--directory-prefix]}} {{path/to/directory}} {{[-i|--input-file]}} {{URLs.txt}}`