wgetDownload files reliably
wget downloads files over HTTP, HTTPS and FTP and saves them to disk. It follows redirects, retries on failure, resumes partial downloads with -c and can mirror whole sites: ideal for fetching releases and artifacts in scripts and Dockerfiles.
wget [-q] [-c] [-O FILE] [-P DIR] [--tries=N] [--timeout=SEC] URL...You need the new release tarball on a server to install it by hand.
wgetGNU Wget: a non-interactive downloader. It keeps working after you log out.
wget resolves the host (getaddrinfo, so /etc/hosts and DNS), connects to port 80 or 443, runs TLS with OpenSSL on Ubuntu (verifying the certificate against the system CA store), and sends a GET request. It follows redirects automatically (up to 20), prints the status, the Content-Length and the file it is saving to, and streams the body to disk. If the transfer breaks it retries (20 tries by default for transient errors). With -c it looks at the size of the local file and sends Range: bytes=N-; the server answers 206 Partial Content and wget appends only the missing bytes. If the server ignores ranges, wget starts again from zero. In recursive mode (-r, --mirror) it parses downloaded HTML for links and fetches them too, respecting robots.txt. Exit codes say what failed: 4 network, 5 TLS verification, 6 authentication, 8 an HTTP error such as 404.
-O FILESave as FILE (-O - prints the body to stdout)-P DIRSave into directory DIR, keeping the remote file name-cContinue a partial download instead of starting over-q / -nvQuiet / non-verbose: one line per file--show-progressShow the progress bar even with -q--tries=NRetry count (default 20; 0 means forever)--timeout=SECDNS, connect and read timeout--spiderCheck the URL exists without downloading it-SPrint the server's response headers--header='K: V'Add a request header, for example an auth token-bGo to background immediately and log to wget-log-r / --mirrorRecursive download / mirror a site with timestamps--limit-rate=1mCap bandwidth so a big download doesn't starve the app--no-check-certificateSkip TLS verification (avoid; only for throwaway tests)wget URL in a script, then using the file without checkingOn failure wget may leave no file, a partial file, or (with -O) an empty file, and the script carries on.
wget -q -O app.tar.gz URL || exit 1 # or set -eRunning wget twice for the same URLThe second run doesn't overwrite: it saves app.tar.gz.1, and later steps use the old file.
wget -O app.tar.gz URL # or -c to finish a partial one, -N to refresh if newer--no-check-certificate to get past a TLS errorIt disables server authentication; a tampered binary would install silently.
Fix the certificate, or add the internal CA: --ca-certificate=/path/ca.pemLeaving wget's defaults in CI20 retries with back-off and long timeouts make a dead mirror look like a hung build for many minutes.
wget --tries=3 --timeout=10 URLTry these on a Linux machine of your own. Each task has a hint and a solution.
There's no internet in the sandbox. Use wget to request http://localhost/ and read wget's messages: did anything answer?
Request a URL on a closed local port with only 1 try and a 2-second timeout, then print wget's exit code.
Write the wget command that downloads https://downloads.devops-lab.io/releases/app-2.14.1.tar.gz into /opt/releases, resuming if a partial file is there, quietly but with a progress bar.
wgetDownload files reliably
wget downloads files over HTTP, HTTPS and FTP and saves them to disk. It follows redirects, retries on failure, resumes partial downloads with -c and can mirror whole sites: ideal for fetching releases and artifacts in scripts and Dockerfiles.
wget [-q] [-c] [-O FILE] [-P DIR] [--tries=N] [--timeout=SEC] URL...You need the new release tarball on a server to install it by hand.
wgetGNU Wget: a non-interactive downloader. It keeps working after you log out.
wget resolves the host (getaddrinfo, so /etc/hosts and DNS), connects to port 80 or 443, runs TLS with OpenSSL on Ubuntu (verifying the certificate against the system CA store), and sends a GET request. It follows redirects automatically (up to 20), prints the status, the Content-Length and the file it is saving to, and streams the body to disk. If the transfer breaks it retries (20 tries by default for transient errors). With -c it looks at the size of the local file and sends Range: bytes=N-; the server answers 206 Partial Content and wget appends only the missing bytes. If the server ignores ranges, wget starts again from zero. In recursive mode (-r, --mirror) it parses downloaded HTML for links and fetches them too, respecting robots.txt. Exit codes say what failed: 4 network, 5 TLS verification, 6 authentication, 8 an HTTP error such as 404.
-O FILESave as FILE (-O - prints the body to stdout)-P DIRSave into directory DIR, keeping the remote file name-cContinue a partial download instead of starting over-q / -nvQuiet / non-verbose: one line per file--show-progressShow the progress bar even with -q--tries=NRetry count (default 20; 0 means forever)--timeout=SECDNS, connect and read timeout--spiderCheck the URL exists without downloading it-SPrint the server's response headers--header='K: V'Add a request header, for example an auth token-bGo to background immediately and log to wget-log-r / --mirrorRecursive download / mirror a site with timestamps--limit-rate=1mCap bandwidth so a big download doesn't starve the app--no-check-certificateSkip TLS verification (avoid; only for throwaway tests)wget URL in a script, then using the file without checkingOn failure wget may leave no file, a partial file, or (with -O) an empty file, and the script carries on.
wget -q -O app.tar.gz URL || exit 1 # or set -eRunning wget twice for the same URLThe second run doesn't overwrite: it saves app.tar.gz.1, and later steps use the old file.
wget -O app.tar.gz URL # or -c to finish a partial one, -N to refresh if newer--no-check-certificate to get past a TLS errorIt disables server authentication; a tampered binary would install silently.
Fix the certificate, or add the internal CA: --ca-certificate=/path/ca.pemLeaving wget's defaults in CI20 retries with back-off and long timeouts make a dead mirror look like a hung build for many minutes.
wget --tries=3 --timeout=10 URLTry these on a Linux machine of your own. Each task has a hint and a solution.
There's no internet in the sandbox. Use wget to request http://localhost/ and read wget's messages: did anything answer?
Request a URL on a closed local port with only 1 try and a 2-second timeout, then print wget's exit code.
Write the wget command that downloads https://downloads.devops-lab.io/releases/app-2.14.1.tar.gz into /opt/releases, resuming if a partial file is there, quietly but with a progress bar.