Downloading using wget
Overview
wget
is a command-line utility for downloading files from the web. It supports downloading files using HTTP, HTTPS, and FTP protocols. With wget
, you can retrieve individual files, recursively download entire directories, and even mirror complete websites.
Syntax
wget [options] [URL]
Basic Usage
To download a file using wget
, simply provide the URL of the file you want to download. Here's the basic command format:
wget [URL]
For example, to download a file named "example.txt" from a website, run the following command:
wget http://www.example.com/example.txt
Common Options
-O, --output-document=FILE
: Specifies the name of the output file. By default,wget
uses the original file name from the URL.-P, --directory-prefix=PREFIX
: Sets the directory prefix where the downloaded files will be saved.-r, --recursive
: Enables recursive downloading, allowing you to download entire directories or mirror websites.-N, --timestamping
: Downloads a file only if it is newer than the local copy or if it does not exist.-np, --no-parent
: Preventswget
from following links to parent directories when using recursive mode.-nc, --no-clobber
: Prevents overwriting files if they already exist.--limit-rate=RATE
: Limits the download speed to a specified rate, such as "1m" for 1 megabyte per second or "50k" for 50 kilobytes per second.