wget
download a filewget fetches a URL and saves it as a file, under the name in the address. It is built for downloading: it retries, resumes a broken transfer, and can mirror a whole site.
curl prints a response to the screen; wget saves it to a file.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
The name is resolved and a connection opened to port 443 — the same steps any HTTPS client takes.
200 OK, followed by the size and type of what is about to arrive.
Percentage, bytes received, speed and time. The file is saved in the current directory.
Compare the checksum with the one the publisher lists. If they differ, the file is corrupt or not what it claims to be.
Switches
A switch changes how the command behaves. These are the ones used day to day; man wget lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-O FILE- Save under this name. "-O -" writes to standard output.
-c- Continue a partially downloaded file.
-q- Quiet: no progress output.
-P DIR- Save into this directory.
-i FILE- Read URLs from a file.
-r- Recursive: follow links and download what they point to.
--limit-rate=RATE- Limit the download speed, such as 500k.
-b- Go to the background straight after starting.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
wget -c https://example.com/big.isoResumes a download that was cut off.
wget -O latest.tar.gz https://example.com/downloadSaves under a name of your choosing.
wget -q -O - https://example.com/install.sh | lessSends the download to a pager instead of a file, to read it first.
wget -i urls.txtDownloads every URL listed in a file.
In cybersecurity
A downloaded file is someone else’s code arriving on your machine.
Check the SHA-256 checksum or GPG signature against the publisher’s. HTTPS proves which server you reached, not that the file is the right one.
"wget -O - url | sh" runs whatever the server sends, unseen. Download it, read it, then run it.
--no-check-certificate makes the download open to interception. Fix the certificate problem instead.