Understanding wget
What is wget?
wget
is a command-line tool for retrieving files using the HTTP, HTTPS, and FTP protocols. It is a widely used utility in the Linux and Unix-like operating systems, designed to automate the process of downloading files from the web. wget
is particularly useful for downloading large files, mirroring websites, and scheduling recurring downloads.
Key Features of wget
- Recursive Downloading:
wget
can recursively download an entire website or directory, including all linked files and subdirectories.
- Mirroring:
wget
can create a complete mirror of a website, preserving the directory structure and file names.
- Scheduled Downloads:
wget
can be used to schedule recurring downloads, making it useful for automating tasks such as daily backups or software updates.
- Resumable Downloads:
wget
can resume interrupted downloads, allowing you to pick up where the download left off.
- Logging and Debugging:
wget
provides detailed logging and debugging information, making it easier to troubleshoot download issues.
Basic Usage of wget
The basic syntax for using wget
is:
wget [options] [URL]
Here are some common options:
-O
or --output-document=FILE
: Save the downloaded file with a different name.
-c
or --continue
: Resume a partially downloaded file.
-r
or --recursive
: Recursively download an entire website.
-p
or --page-requisites
: Download all resources (CSS, images, etc.) required to properly display a web page.
-np
or --no-parent
: Do not ascend to the parent directory when recursively downloading.
-q
or --quiet
: Operate in quiet mode, with minimal output.
-v
or --verbose
: Operate in verbose mode, with detailed output.
Here's an example of using wget
to download a file:
wget https://example.com/file.zip
This will download the file file.zip
from the https://example.com
website and save it in the current directory.