What is Wget and How to Use It
This article provides a comprehensive overview of Wget, a widely-used command-line utility for downloading files from the internet. You will learn about its key features, common use cases, and basic command structures, along with a link to the official Wget Command line tool documentation for further learning.
Wget, which stands for “World Wide Web get,” is a free, open-source command-line tool used to retrieve content and files from various web servers. Created by the GNU Project, it supports essential internet protocols such as HTTP, HTTPS, and FTP. Unlike web browsers, Wget is designed to be non-interactive, meaning it can run in the background without user interaction, making it ideal for automated scripts, cron jobs, and terminal-based workflows.
Key Features of Wget:
- Non-Interactive Operation: Wget can continue downloading files even if the user logs off or disconnects from the system.
- Resume Aborted Downloads: If a download is interrupted due to a network failure, Wget can resume the transfer from where it left off, saving bandwidth and time.
- Recursive Downloading: It can crawl websites by following links and directory structures to download entire sites for offline viewing, also known as website mirroring.
- Wildcard Support: It allows users to download multiple files matching specific patterns or extensions (e.g., downloading all PDF files from a specific directory).
Basic Wget Commands:
To download a single file from the web, type wget
followed by the URL of the file:
wget https://example.com/file.zipTo resume a partially downloaded file that was interrupted, use the
-c option:
wget -c https://example.com/largefile.zipTo download an entire website for offline viewing, use the recursive
(-r) option:
wget -r https://example.comTo run a download in the background, use the -b option,
which redirects the command line output to a log file:
wget -b https://example.com/hugefile.zipFor a complete list of commands, advanced configurations, and detailed usage instructions, refer to the Wget Command line tool documentation. This tool is pre-installed on most Linux distributions and is easily installable on macOS and Windows, making it a highly versatile asset for developers and system administrators alike.