Home·Terminal commands

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

FlagMeaning
-O <file>Choose the output name; -O - writes to stdout like curl does.
-cContinue a partly downloaded file instead of starting over.
-qQuiet. Pair with -O - to pipe the body somewhere.
-P <dir>Put downloads into a directory.
-r -np -kRecursive mirror, never climb above the start URL, rewrite links for local reading.
--limit-rate=1mCap the bandwidth so the download does not saturate the line.
-NOnly fetch if the remote file is newer than the local copy.

Examples

wget -c https://example.com/big.iso

Resume 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 | head

Behave 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