Example 1
Download a Single File
$ wget https://example.com/file.zip
--2025-10-18 14:30:00-- https://example.com/file.zip
Resolving example.com... 93.184.216.34
Connecting to example.com|93.184.216.34|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2048576 (2.0M) [application/zip]
Saving to: 'file.zip'
file.zip 100%[========>] 2.00M 1.50MB/s in 1.3s
2025-10-18 14:30:02 (1.50 MB/s) - 'file.zip' saved [2048576/2048576]
Downloads a file from a URL and saves it to the current directory. Shows progress including download speed, time remaining, and completion status. The most basic and common use of wget.
Default Behavior: Saves with original filename from URL
Example 2
Download with Custom Filename
$ wget -O myfile.zip https://example.com/file.zip
Saving to: 'myfile.zip'
Downloads a file and saves it with a different name using the '-O' option. Useful when the URL has a cryptic name or you want to standardize filenames.
Important: Use uppercase -O for output filename
Example 3
Resume Interrupted Download
$ wget -c https://example.com/largefile.iso
HTTP request sent, awaiting response... 206 Partial Content
Length: 4294967296 (4.0G), 2147483648 (2.0G) remaining [application/x-iso]
Saving to: 'largefile.iso'
largefile.iso 50%[+++====>] 2.00G 1.20MB/s eta 28m 15s
Resumes a partially downloaded file using the '-c' option. If the download was interrupted, wget continues from where it left off instead of starting over. Essential for large files on unstable connections.
Convenience: Safe to use even if file doesn't exist - starts fresh download
Example 4
Download in Background
$ wget -b https://example.com/file.zip
Continuing in background, pid 12345.
Output will be written to 'wget-log'.
Downloads in the background using the '-b' option. Wget detaches from the terminal and logs all output to wget-log file. Perfect for long downloads when you need to continue using the terminal.
Log File: Check wget-log for download progress and errors
Example 5
Limit Download Speed
$ wget --limit-rate=500k https://example.com/file.zip
file.zip 25%[====> ] 512K 500KB/s eta 3s
Limits download speed using --limit-rate option. Prevents wget from consuming all available bandwidth. Useful on shared connections or when you need bandwidth for other tasks. Accepts k (kilobytes) or m (megabytes).
Bandwidth Control: Set to comfortable level for background downloads
Example 6
Download Multiple Files
$ wget -i urls.txt
# Contents of urls.txt:
# https://example.com/file1.zip
# https://example.com/file2.tar.gz
# https://example.com/file3.pdf
--2025-10-18 14:30:00-- https://example.com/file1.zip
Saving to: 'file1.zip'
...
--2025-10-18 14:30:15-- https://example.com/file2.tar.gz
Saving to: 'file2.tar.gz'
Downloads multiple files from a list of URLs in a text file using the '-i' option. Each line in the file should contain one URL. Excellent for batch downloads or scripted deployments.
Batch Processing: Create URL list files for reproducible downloads
Example 7
Download Entire Website
$ wget --mirror --convert-links --page-requisites https://example.com
--2025-10-18 14:30:00-- https://example.com/
...
Downloaded: 45 files, 2.5M in 12s (214 KB/s)
Downloads an entire website for offline viewing. --mirror creates local copy, --convert-links adjusts links for local browsing, --page-requisites downloads CSS/images. Creates directory structure matching the site.
Offline Browsing: Create complete local copy of websites
Example 8
Retry Failed Downloads
$ wget --tries=10 https://example.com/file.zip
HTTP request sent, awaiting response... Connection timed out.
Retrying.
--2025-10-18 14:30:30-- (try: 2) https://example.com/file.zip
Sets the number of retry attempts using --tries option. Default is 20. Use 0 for infinite retries. Useful for unreliable connections or servers that occasionally timeout.
Reliability: Combine with -c for resumable, retry-enabled downloads
Example 9
Download with Authentication
$ wget --user=username --password=password https://example.com/file.zip
Connecting to example.com... connected.
HTTP request sent, awaiting response... 401 Authorization Required
HTTP request sent, awaiting response... 200 OK
Downloads from password-protected sites using --user and --password options. Supports HTTP authentication. For better security, use --ask-password to prompt instead of showing password in command.
Security: Use --ask-password to avoid exposing credentials in command history
Example 10
Download Quietly
$ wget -q https://example.com/file.zip
# No output unless error occurs
Downloads silently using the '-q' option. Suppresses all output except errors. Perfect for scripts where you don't want progress bars cluttering logs. Combine with -O to redirect output.
Scripting: Use -q in automated scripts for cleaner output