tldr/pages/common/wget.md

38 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2014-02-24 16:29:46 +00:00
# wget
> Download files from the Web.
> Supports HTTP, HTTPS, and FTP.
> More information: <https://www.gnu.org/software/wget>.
2014-02-24 16:29:46 +00:00
- Download the contents of a URL to a file (named "foo" in this case):
2014-02-24 16:29:46 +00:00
`wget {{https://example.com/foo}}`
2014-02-24 16:29:46 +00:00
- Download the contents of a URL to a file (named "bar" in this case):
2017-12-06 10:45:26 +00:00
2021-05-04 08:25:49 +01:00
`wget --output-document {{bar}} {{https://example.com/foo}}`
2017-12-06 10:45:26 +00:00
2019-02-26 22:15:47 +00:00
- Download a single web page and all its resources with 3-second intervals between requests (scripts, stylesheets, images, etc.):
2014-02-24 16:29:46 +00:00
2019-02-26 22:15:47 +00:00
`wget --page-requisites --convert-links --wait=3 {{https://example.com/somepage.html}}`
2014-02-24 16:29:46 +00:00
2018-01-09 08:29:24 +00:00
- Download all listed files within a directory and its sub-directories (does not download embedded page elements):
`wget --mirror --no-parent {{https://example.com/somepath/}}`
2019-02-26 22:15:47 +00:00
- Limit the download speed and the number of connection retries:
`wget --limit-rate={{300k}} --tries={{100}} {{https://example.com/somepath/}}`
- Download a file from an HTTP server using Basic Auth (also works for FTP):
2014-02-24 16:29:46 +00:00
2019-02-26 22:15:47 +00:00
`wget --user={{username}} --password={{password}} {{https://example.com}}`
2014-02-24 16:29:46 +00:00
- Continue an incomplete download:
2014-02-24 16:29:46 +00:00
2021-05-04 08:25:49 +01:00
`wget --continue {{https://example.com}}`
2016-05-15 14:49:44 +01:00
2019-02-26 22:15:47 +00:00
- Download all URLs stored in a text file to a specific directory:
2016-05-15 14:49:44 +01:00
2021-05-04 08:25:49 +01:00
`wget --directory-prefix {{path/to/directory}} --input-file {{URLs.txt}}`