Linux Command: wget
Download files from the web (HTTP, HTTPS, FTP)
wget is a non-interactive file downloader that supports HTTP, HTTPS, and FTP protocols. It is designed for reliable downloads even on unstable connections, with automatic retry and resume capabilities. wget excels at downloading files, mirroring websites, and recursive downloads. Unlike curl which outputs to stdout by default, wget saves directly to files. It handles redirects, cookies, authentication, and can download entire website structures. wget is ideal for scripting and automation, working in the background, downloading large files over unreliable connections, and creating offline mirrors of websites.
Syntax
wget [OPTION]... [URL]...Key Options
-Oโ Save to specific filename-cโ Resume interrupted download-rโ Recursive download-qโ Quiet mode-bโ Download in background--mirrorโ Mirror a website (recursive + timestamps)
Examples
Download a file
wget https://example.com/archive.tar.gzResume interrupted download
wget -c https://example.com/large-file.isoDownload with custom filename
wget -O backup.sql.gz https://db.example.com/dump/latestPro Tips
- Always use wget -c for large files. If the connection drops, re-running the same command resumes from where it stopped.
- wget is better for file downloads, recursive crawling, and background operations. curl is better for API testing, custom headers, and supporting many protocols.
- wget -r without -l (depth limit) can download entire websites and consume massive disk space. Always set a depth limit.
Learn more: Full wget reference โ
Related Resources