wget Command Reference for CI Scripts
wget downloads files over HTTP, HTTPS, and FTP without needing a terminal.
wget is the other ubiquitous downloader. It returns non-zero on server errors by default, which is convenient, but its exit codes are coarser than curl.
Common flags/usage
- -O FILE: write to a specific file (-O- writes to stdout)
- -q: quiet, no progress output
- --tries=N: retry up to N times (0 means infinite)
- --timeout=SECS: cap DNS, connect, and read time
- -c: resume a partial download
Example
shell
wget -q --tries=5 --timeout=20 \
-O tool.bin "https://example.com/${TOOL}/download"
wget -qO- https://get.example.com/install.sh | shIn CI
wget exits 8 on an HTTP error like 404 and 4 on a network failure, so a failed download stops the job without -f. Note that -O with multiple URLs concatenates them into one file and silently corrupts archives. Minimal images (alpine) often lack wget, so prefer curl or install it.
Key takeaways
- wget fails on HTTP errors by default, so a 404 stops the job without an extra flag.
- Use --tries and --timeout so a hung mirror does not stall the runner.
- Avoid -O with multiple URLs; it merges them into one corrupt file.
Related guides
curl Command Reference for CI Scriptscurl transfers data over HTTP(S) in CI scripts. Reference for -f, -sS, -L, -o, and --retry so downloads fail…
tar Command Reference for CI Scriptstar bundles and extracts archives in CI for caches and artifacts. Reference for -c, -x, -z, -C, and the compr…
sha256sum Command Reference for CI Scriptssha256sum computes and verifies checksums in CI for download integrity. Reference for -c verify mode, --statu…
gzip Command Reference for CI Scriptsgzip compresses single files with DEFLATE in CI. Reference for -d, -k, -c, and compression levels, plus the t…