📘 Post

Efficient File Downloads with Wget commands: Key Commands and Usages

11/12/2024 By Sanchit Agrawal 3 min read 👁 442 views Updated 08/21/2026

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.

wget commands

Basic Syntax – wget commands

The basic syntax of wget is:

Command
wget [options] [URL]

Common Options and Examples – wget commands

1. Download a Single File

  • Command:
Command
wget http://sanchitgurukul.xyz/file.txt

Explanation: Downloads file.txt from http://sanchitgurukul.xyz.

2. Download and Save with a Different Name

  • Command:
Command
wget -O newfile.txt http://sanchitgurukul.xyz/file.txt

Explanation: Downloads the file and saves it as newfile.txt.

3. Resume a Partially Downloaded File

  • Command:
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:
Command
wget -b http://sanchitgurukul.xyz/largefile.zip
  • Explanation: Downloads largefile.zip in the background.
  • Output:
Output / Result
Continuing in background, pid 12345. Output will be written to 'largefile.zip'.

5. Limit Download Speed

  • Command:
Command
wget --limit-rate=200k http://sanchitgurukul.xyz/file.iso
  • Explanation: Limits the download speed to 200 KB/s.

6. Recursive Download

  • Command:
Command
wget -r http://sanchitgurukul.xyz/dir/

7. Mirror a Website

  • Command:
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:
Command
  • Explanation: Sets the User-Agent header to mimic a web browser.

9. Use HTTP Authentication

  • Command:
Command
wget --user=username --password=password http://sanchitgurukul.xyz/securefile.txt
  • Explanation: Provides HTTP authentication credentials.

10. Download via FTP

  • Command:
Command
wget ftp://ftp.sanchitgurukul.xyz/file.txt
  • Explanation: Downloads file.txt from an FTP server.

11. Download with FTP Authentication

  • Command:
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:
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:
Command
  • Explanation: Recursively downloads only .jpg and .png files.

14. Download and Save with a Timestamp

  • Command:
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:
Command
wget -q http://sanchitgurukul.xyz/file.txt
  • Explanation: Suppresses output, showing only errors and warnings.

16. Show Download Progress

  • Command:
Command
wget --show-progress http://sanchitgurukul.xyz/file.txt
  • Explanation: Displays a progress bar during the download.

17. Specify Download Directory

  • Command:
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:
Command
wget -a logfile.txt http://sanchitgurukul.xyz/file.txt
  • Explanation: Appends the download output to logfile.txt.

19. Use Cookies

  • Command:
Command
wget --load-cookies cookies.txt http://sanchitgurukul.xyz
  • Explanation: Uses cookies from cookies.txt for the download.

20. Download with Specific Timeout

  • Command:
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.txt downloads file.txt from the given website.
  • wget -r [URL]: Enables recursive downloading, which retrieves files from a website and its subdirectories. The -r option 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.

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.

Disclaimer: This article may contain information that was accurate at the time of writing but could be outdated now. Please verify details with the latest vendor advisories or contact us at admin@sanchitgurukul.com.

Your feedback matters

Was this post helpful?

0 reactions

SanchitGurukul — Technology • Education • Innovation

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.

This field is not used to determine whether a comment is safe.

Plain text only. File uploads, scripts, executable code, abuse and spam are not accepted.


Discover more from SanchitGurukul

Subscribe to get the latest posts sent to your email.

Share this article

Help others find this guide.

Namaste! I’m SG Saarthi 👋Need help learning or finding something?

Discover more from SanchitGurukul

Subscribe now to keep reading and get access to the full archive.

Continue reading