How to download files with wget or curl
Overview
wget is convenient for saving files, while curl transfers URLs and prints response bodies by default. Install either with APT if it is missing.
Examples
wget https://example.com/file.zip
wget -O archive.zip https://example.com/download
curl -O https://example.com/file.zip
curl -L -o archive.zip https://example.com/download
curl -I https://example.com
Useful options
wget -cattempts to continue a partial downloadwget -O namechooses the output filenamecurl -Lfollows redirectscurl -o namewrites to a chosen filenamecurl -Ouses the remote filenamecurl -Irequests response headers
Safety
A successful download does not make a file trustworthy. Verify the site, HTTPS URL, checksum, or signature before opening or executing it.
Avoid patterns such as downloading a script and piping it directly to sudo sh; inspect downloaded scripts first.