Exploring wget - Linux Commands

What is the wget Command in Linux?

The wget command in Linux is a powerful, non-interactive tool for downloading files from the internet. It supports HTTP, HTTPS, and FTP protocols, and can work in the background, making it ideal for scripting and automated downloads. Key features include:

  • Resuming interrupted downloads
  • Downloading recursively (entire websites)
  • Working with proxies
  • Limiting bandwidth usage
  • Running without user interaction

Basic Syntax:

wget [OPTIONS] URL

Example:

wget https://example.com/file.zip

Options

OptionWhat It DoesExample
-O FILERename downloaded filewget -O backup.zip [URL]
-P DIRSave to directorywget -P ~/downloads [URL]
-cResume broken downloadwget -c [URL]
-ncSkip existing fileswget -nc [URL]
--limit-rate=SPEEDLimit speedwget --limit-rate=2M [URL]
-qSilent modewget -q [URL]
-bDownload in backgroundwget -b [URL]
-i FILEDownload URLs from filewget -i urls.txt
-t NRetry attempts (default=20)wget -t 3 [URL]
-T SECTimeout in secondswget -T 30 [URL]

Common Use Case

  • Download and rename
wget -O gnu-keyring.gpg https://ftp.gnu.org/gnu/gnu-keyring.gpg
  • Save to specific directory
wget -P ~/Downloads https://www.gutenberg.org/files/1342/1342-0.txt
  • Resume failed download
wget -c https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.11.tar.xz
  • Download without overwriting
wget -nc https://www.gutenberg.org/files/11/11-0.txt  # Alice in Wonderland
wget -nc https://www.gutenberg.org/files/11/11-0.txt  # Skips if already downloaded
  • Limit download speed
wget --limit-rate=100k https://speed.hetzner.de/100MB.bin
  • Silent download (for scripts)
wget -q https://www.gutenberg.org/files/84/84-0.txt  # Frankenstein
  • Background download
wget -b https://www.gutenberg.org/files/2701/2701-0.txt  # Moby Dick
tail -f wget-log  # Check progress

Additional Help

To see all available wget options:

wget --help
# or
man wget

Recap

The wget command is an indispensable tool for downloading files from the command line. Whether you need to download single files, mirror entire websites, or automate downloads in scripts, wget provides a robust solution with many configuration options.

Happy downloading! 💾🚀

Thank you!

Thank you for your time and for reading this!