Overview – wget commands and options
wget commands is a powerful command-line utility for downloading files from the web. Below is a comprehensive list of common wget commands and options, along with examples to illustrate their usage.

Basic Syntax – wget commands
The basic syntax of wget is:
wget [options] [URL]Common Options and Examples – wget commands
1. Download a Single File
- Command:
wget http://sanchitgurukul.xyz/file.txtExplanation: Downloads file.txt from http://sanchitgurukul.xyz.
2. Download and Save with a Different Name
- Command:
wget -O newfile.txt http://sanchitgurukul.xyz/file.txtExplanation: Downloads the file and saves it as newfile.txt.
3. Resume a Partially Downloaded File
- Command:
wget -c http://sanchitgurukul.xyz/largefile.zip- Explanation: Resumes the download of largefile.zip if it was interrupted.
4. Download Files in Background
- Command:
wget -b http://sanchitgurukul.xyz/largefile.zip- Explanation: Downloads largefile.zip in the background.
- Output:
Continuing in background, pid 12345. Output will be written to 'largefile.zip'.5. Limit Download Speed
- Command:
wget --limit-rate=200k http://sanchitgurukul.xyz/file.iso- Explanation: Limits the download speed to 200 KB/s.
6. Recursive Download
- Command:
wget -r http://sanchitgurukul.xyz/dir/- Explanation: Recursively downloads all files from http://example.com/dir/.
7. Mirror a Website
- Command:
wget --mirror -p --convert-links -P ./local-dir http://sanchitgurukul.xyz- Explanation: Creates a local copy of the entire website.
8. Set User-Agent
- Command:
- Explanation: Sets the User-Agent header to mimic a web browser.
9. Use HTTP Authentication
- Command:
wget --user=username --password=password http://sanchitgurukul.xyz/securefile.txt- Explanation: Provides HTTP authentication credentials.
10. Download via FTP
- Command:
wget ftp://ftp.sanchitgurukul.xyz/file.txt- Explanation: Downloads file.txt from an FTP server.
11. Download with FTP Authentication
- Command:
wget --ftp-user=username --ftp-password=password ftp://ftp.sanchitgurukul.xyz/file.txt- Explanation: Provides FTP authentication credentials.
12. Download Using a Proxy Server
- Command:
wget -e use_proxy=yes -e http_proxy=proxy.sanchitgurukul.xyz:8080 http://sanchitgurukul.xyz/file.txt- Explanation: Downloads file.txt using a proxy server.
13. Accept or Reject Specific File Types
- Command:
- Explanation: Recursively downloads only .jpg and .png files.
14. Download and Save with a Timestamp
- Command:
wget -N http://sanchitgurukul.xyz/file.txt- Explanation: Downloads file.txt only if the remote file is newer than the local file.
15. Quiet Mode
- Command:
wget -q http://sanchitgurukul.xyz/file.txt- Explanation: Suppresses output, showing only errors and warnings.
16. Show Download Progress
- Command:
wget --show-progress http://sanchitgurukul.xyz/file.txt- Explanation: Displays a progress bar during the download.
17. Specify Download Directory
- Command:
wget -P /path/to/directory http://sanchitgurukul.xyz/file.txt- Explanation: Downloads file.txt to the specified directory.
18. Append Output to a File
- Command:
wget -a logfile.txt http://sanchitgurukul.xyz/file.txt- Explanation: Appends the download output to logfile.txt.
19. Use Cookies
- Command:
wget --load-cookies cookies.txt http://sanchitgurukul.xyz- Explanation: Uses cookies from cookies.txt for the download.
20. Download with Specific Timeout
- Command:
wget --timeout=30 http://sanchitgurukul.xyz/file.txt- Explanation: Sets a timeout of 30 seconds for the download.
Summary – wget commands
wget commands is a powerful and versatile command-line tool for downloading files from the web. It supports a wide range of features, including recursive downloads, mirroring websites, limiting download speeds, and handling authentication. By mastering these options and commands, users can efficiently automate and manage their file downloads from the internet.
wget commands is a powerful command-line utility used for downloading files from the web. It supports HTTP, HTTPS, and FTP protocols and offers robust options for handling various download tasks.
Key wget commands include:
wget [URL]: Basic command to download a file from the specified URL. For example,wget http://example.com/file.txtdownloadsfile.txtfrom the given website.wget -r [URL]: Enables recursive downloading, which retrieves files from a website and its subdirectories. The-roption stands for recursive.wget --limit-rate=200k [URL]: Limits the download speed to 200 KB/s, which can be useful for managing bandwidth usage.wget --mirror -p --convert-links -P ./local-dir [URL]: Mirrors a website, including all pages and media files, adjusts links for local viewing, and saves the content to./local-dir.wget --no-check-certificate [URL]: Downloads files from sites with self-signed SSL certificates by skipping certificate verification.
These commands provide flexibility for downloading individual files, mirroring websites, and managing download speeds. wget is highly customizable, making it a versatile tool for users needing to handle downloads efficiently.
Useful Links
Efficient File Downloads with Wget commands: Key Commands and Usages
This article provided insights on the topic. For latest updates and detailed guides, stay connected with Sanchit Gurukul.
Your feedback matters
Was this post helpful?
Discussion
0 approved comments
No approved comments yet. You can start the discussion below.
Leave a Comment
No login is required. Name and email are used for moderation/security. Your email is never displayed publicly. All comments require administrator approval.
Discover more from SanchitGurukul
Subscribe to get the latest posts sent to your email.