The wget Command

wget is the simple file downloader. Point it at a URL, get a file.

Basic Download

Terminal
$wget https://example.com/file.zip
--2025-01-14 10:30:45-- https://example.com/file.zip Resolving example.com... 93.184.216.34 Connecting to example.com... connected. HTTP request sent, awaiting response... 200 OK Length: 1048576 (1.0M) [application/zip] Saving to: 'file.zip' file.zip 100%[=====>] 1.00M 1.50MB/s in 0.7s

Progress bar included by default. File saves to current directory.

Specify Output Name

Terminal
$wget -O custom-name.zip https://example.com/file.zip
(saves as custom-name.zip)

Resume Interrupted Download

Terminal
$wget -c https://example.com/large-file.zip
(continues where it left off)

-c (continue) is perfect for large files over unreliable connections.

Download in Background

Terminal
$wget -b https://example.com/huge-file.iso
Continuing in background, pid 1234. Output will be written to 'wget-log'.

-b runs in background. Check wget-log for progress.

Quiet Mode

Terminal
$wget -q https://example.com/file.zip
(no output)

-q suppresses all output - useful in scripts.

Download Multiple Files

From a list:

Terminal
$cat urls.txt
https://example.com/file1.zip https://example.com/file2.zip https://example.com/file3.zip
$wget -i urls.txt
(downloads all)

Limit Speed

Terminal
$wget --limit-rate=1M https://example.com/file.zip
(max 1 MB/s)

Be polite to servers, or avoid saturating your connection.

wget vs curl

Featurewgetcurl
Download filesExcellentGood
Resume downloadsYes (-c)Yes
Recursive downloadYesNo
API testingLimitedExcellent
HTTP methodsGET mainlyAll
Scripting outputBasicFlexible

When to Use Which

  • wget: Downloading files
  • curl: API testing, flexible HTTP requests

Both can download. wget is simpler, curl is more powerful.

Common Use Cases

Download Software Release

Terminal
$wget https://github.com/user/repo/releases/download/v1.0/app.tar.gz

Download Script and Run

Terminal
$wget -O - https://example.com/install.sh | bash

-O - outputs to stdout instead of file.

Piping to bash

Be careful with | bash. Only do this from trusted sources. You're running arbitrary code.

Knowledge Check

How do you resume an interrupted wget download?

Quick Reference

FlagPurpose
-O fileOutput to specific file
-cContinue/resume download
-bBackground download
-qQuiet (no output)
-i fileDownload URLs from file
--limit-rate=XLimit bandwidth

Key Takeaways

  • wget URL downloads a file
  • -c resumes interrupted downloads
  • -O filename specifies output name
  • -q for quiet scripting
  • Use wget for downloads, curl for APIs

Next: checking open ports and connections.