
{{ $('Map tags to IDs').item.json.title }}
How to Use wget to Download Files
wget is a powerful command-line utility used for downloading files from the web. It supports HTTP, HTTPS, and FTP protocols and is widely used for its ability to handle downloads in various scenarios. This tutorial will guide you through the basics of using wget to download files effectively.
1. Installing wget
Most Linux distributions come with wget pre-installed. To check if it’s available, run:
wget --version
If it’s not installed, you can install it using the following commands:
- For Ubuntu:
sudo apt update sudo apt install wget
- For CentOS:
sudo yum install wget
2. Downloading a Single File
The basic command to download a file using wget is:
wget http://example.com/file.zip
Replace http://example.com/file.zip
with the actual URL of the file you want to download.
3. Downloading into a Specific Directory
To specify a download directory, use the -P
option:
wget -P /path/to/directory http://example.com/file.zip
This command downloads the file directly to the specified directory.
4. Downloading Multiple Files
You can download multiple files by listing all URLs in a text file (one URL per line) and using the -i
option:
wget -i urls.txt
This will download all the files listed in urls.txt
.
5. Resuming an Interrupted Download
If a download is interrupted, you can resume it using the -c
option:
wget -c http://example.com/file.zip
This command tells wget to continue downloading the file from where it left off.
6. Downloading Entire Web Pages
To download a complete web page along with all linked resources (like images), use the -p
option:
wget -p http://example.com
This command downloads the specified page and all necessary assets for offline viewing.
7. Conclusion
By following this tutorial, you have learned how to effectively use wget to download files from the internet on Linux. wget is a versatile tool that can handle a multitude of downloading tasks, making it invaluable for developers and system administrators. Continue exploring wget’s powerful options to further enhance your downloading activities!