wget vs curl: Choosing One in CI
wget saves to a file by default and can recurse; curl prints to stdout by default and is the transfer Swiss army knife.
Both tools download over HTTP. The right pick depends on what the runner ships and whether you need recursion, retries, or stdout piping.
What it does
wget defaults to saving a file named from the URL and supports recursive and mirror downloads. curl defaults to writing to stdout, supports far more protocols and request options, but does not recurse. For a simple "download this file to disk," wget is fewer flags; for scripting an API, curl is more flexible.
Common usage
# download a file to disk
wget -q https://example.com/app.bin # saves app.bin
curl -fsSL -O https://example.com/app.bin # saves app.bin
# follow redirects + fail on HTTP error
wget https://example.com/app.bin # follows by default
curl -fL https://example.com/app.bin -o app.binEquivalents
| Task | wget vs curl |
|---|---|
| Save with URL name | wget URL vs curl -O URL |
| Save to a name | wget -O f URL vs curl -o f URL |
| Quiet | wget -q vs curl -s |
| Follow redirects | on by default vs curl -L |
| Fail on HTTP error | non-zero on 404 by default vs curl -f |
| Recursive / mirror | wget -r / --mirror vs (not supported) |
In CI
Pick whichever is already installed to avoid an extra install step. Choose wget for recursive or mirror pulls and simple file saves; choose curl for API calls, custom methods, and stdout piping. Note curl does not fail on HTTP errors unless you add -f, while wget returns non-zero on a 404 by default.
Common errors in CI
curl silently saving a 404 error page happens because curl needs -f to fail on HTTP errors; wget exits non-zero on 404 without extra flags. wget: command not found or curl: command not found means that tool is not on the image; switch to the other or install it first.