wget: Usage, Options & Common CI Errors
wget downloads files over HTTP, HTTPS, and FTP without needing a TTY.
wget is the other ubiquitous downloader. It fails on HTTP errors by default (unlike curl), which makes it convenient but its exit codes are coarser.
What it does
wget retrieves files over HTTP, HTTPS, and FTP. It is non-interactive, can resume partial downloads, and by default returns a non-zero exit on server errors like 404.
Common usage
wget https://example.com/file.tar.gz
wget -O out.bin https://example.com/file
wget -q https://example.com/x # quiet
wget --tries=5 --timeout=20 https://example.com/x
wget -qO- https://example.com/install.sh | shOptions
| Flag | What it does |
|---|---|
| -O <file> | Write to a specific file (-O- = stdout) |
| -q / --quiet | No output |
| --tries=N | Retry up to N times (0 = infinite) |
| --timeout=SECS | Set read/connect/DNS timeout |
| -c / --continue | Resume a partial download |
| --no-check-certificate | Skip TLS verification (avoid in prod) |
Common errors in CI
ERROR 404: Not Found exits 8 (server issued an error response). "Unable to resolve host address" exits 4 (network failure). "wget: command not found" - minimal images (alpine) ship without it; install wget or use curl. Mixing -O with multiple URLs concatenates them into one file, which silently corrupts archives.