Table of Contents
wget is a powerful command-line tool used to download files, websites, and data over HTTP, HTTPS, and FTP. It’s available on almost every Linux distribution and is essential for system administrators, developers, and automation scripts.
Step 1: Install wget on Ubuntu / Debian
Update your system and install:
sudo apt update && sudo apt install -y wget
Verify installation:
wget --version
Step 2: Install wget on CentOS / Rocky / AlmaLinux
sudo dnf install -y wget
Check version:
wget --version
Step 3: Install wget on Arch Linux
sudo pacman -S wget
Using wget in Linux
Below are the most practical and commonly used wget commands you’ll use daily.
Step 4: Download a File from a URL
wget https://example.com/file.zip
This saves file.zip in your current directory.
Step 5: Download and Save with a Custom Name
wget -O myfile.zip https://example.com/file.zip
Step 6: Resume a Stopped Download
If your connection breaks:
wget -c https://example.com/bigfile.iso
The -c flag resumes the partial download.
Step 7: Download an Entire Website (Mirror Mode)
wget -m https://example.com
This clones the entire site locally.
Step 8: Download Multiple Files from a List
Create links.txt:
https://site.com/file1.zip
https://site.com/file2.zip
Download all:
wget -i links.txt
Step 9: Limit Download Speed
Useful for not overloading your bandwidth:
wget --limit-rate=500k https://example.com/largefile.zip
Step 10: Download in Background
wget -b https://example.com/bigfile.iso
View progress:
tail -f wget-log
Step 11: Set Number of Retry Attempts
wget --tries=5 https://example.com/file.zip
Optional Step: Use wget with Proxy
wget -e use_proxy=yes -e http_proxy=http://proxy-ip:proxy-port https://example.com/file.zip
If you’re automating downloads inside scripts, combine flags like -c, -q, and --show-progress for cleaner output and reliable retries.
U
Loading...
