wget
Overview
The wget
command is a network utility to retrieve files from the web using HTTP, HTTPS, and FTP protocols. It supports recursive download, file transfer resumption, and bandwidth limiting.
Syntax
wget [options] [URL...]
Common Options
Option | Description |
---|---|
-O file |
Output to file |
-P prefix |
Directory prefix |
-c |
Continue download |
-r |
Recursive retrieval |
-l depth |
Maximum depth |
-np |
No parent |
-nd |
No directories |
-A list |
Accept list |
-R list |
Reject list |
-q |
Quiet mode |
-v |
Verbose mode |
--limit-rate |
Bandwidth limit |
Key Use Cases
- File download
- Website mirroring
- Recursive download
- FTP retrieval
- Automated downloads
Examples with Explanations
Example 1: Basic Download
wget https://example.com/file
Download single file
Example 2: Continue Download
wget -c https://example.com/large-file
Resume interrupted download
Example 3: Mirror Website
wget -m https://example.com
Mirror entire site
Common Usage Patterns
Save as file:
wget -O output.file URL
Recursive with depth:
wget -r -l2 URL
Accept types:
wget -A pdf,jpg URL
Security Considerations
- SSL verification
- Authentication
- Server load
- Bandwidth usage
- Robot rules
Additional Resources
Best Practices
- Use continue
- Set timeouts
- Limit bandwidth
- Check robots.txt
- Verify downloads
Download Options
- Single file
- Multiple files
- Recursive
- Mirror
- Timestamping
Troubleshooting
- SSL errors
- DNS issues
- Server errors
- Permission denied
- Space issues
Output Formats
- Progress bar
- Dot progress
- Quiet output
- Debug info
- Log file