wget
Networking
Usage
wget [options] <url>Downloads a URL into a file and follows redirects on its own; that is the difference from curl, which prints to the terminal unless told otherwise, and macOS does not ship wget.
Common flags
| Flag | Meaning |
|---|---|
| -O <file> | Choose the output name; -O - writes to stdout like curl does. |
| -c | Continue a partly downloaded file instead of starting over. |
| -q | Quiet. Pair with -O - to pipe the body somewhere. |
| -P <dir> | Put downloads into a directory. |
| -r -np -k | Recursive mirror, never climb above the start URL, rewrite links for local reading. |
| --limit-rate=1m | Cap the bandwidth so the download does not saturate the line. |
| -N | Only fetch if the remote file is newer than the local copy. |
Examples
wget -c https://example.com/big.isoResume a large download after the connection dropped.
wget -r -np -k https://example.com/docs/Mirror a documentation tree for offline reading.
wget -qO- https://example.com | headBehave like curl and print to the terminal.
When a connection fails, these narrow down how far it got — name not resolving, no route, or a blocked port.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does wget do?
Downloads a URL into a file and follows redirects on its own; that is the difference from curl, which prints to the terminal unless told otherwise, and macOS does not ship wget.
Q. How do I type it?
wget [options] <url> — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
7 are listed here; the full set is in man wget. This command sits under Networking.
Related commands
man page: man wget