📅  最后修改于: 2023-12-03 15:02:42.940000             🧑  作者: Mango
wget
is a command-line utility that allows you to download files from the internet. It is available on Linux, macOS, and Windows operating systems.
Ubuntu/Debian
To install wget
on Ubuntu or Debian, open a terminal and run the following command:
sudo apt-get install wget
Fedora/CentOS
To install wget
on Fedora or CentOS, open a terminal and run the following command:
sudo dnf install wget
To download a file using wget
, open a terminal and type the following command:
wget <file_url>
For example, to download the latest version of Ubuntu, run:
wget https://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso
By default, wget
downloads the file to the current directory. If you want to save the file to a specific directory, use the -P
option, followed by the directory path:
wget -P /path/to/directory <file_url>
You can also use the -O
option to specify the output filename:
wget -O output-file-name <file_url>
To download multiple files, you can create a text file containing the list of URLs and use the -i
option to download them in batch:
wget -i urls.txt
You can also use wget
to download a website, including all of its assets (HTML, images, etc.):
wget --mirror --convert-links --page-requisites --no-parent <website_url>
This will create a complete mirror of the website in the current directory.
wget
is a powerful command-line utility that can simplify the process of downloading files from the internet. With its ability to download multiple files and entire websites, it is a useful tool for developers and power users alike.