How to Download an Entire Website (Wget Tutorial)
Wget is a free tool that can be used to download entire websites. It runs on Windows, Mac, and Linux.
First I’ll explain how to install Wget, followed by an explanation of how to use it.
How to Install Wget
Here are instructions for how to install Wget on Mac, Windows, and Linux.
Install Wget on Mac
If you’re using Mac and have Homebrew installed, you can install Wget with these commands:
brew update
brew install wgetInstall Wget on Linux
Your Linux distribution might already have wget installed. To check, type this command in a terminal:
wget --versionIf the command can’t be found, install it with your distro’s package manager. For example, if you’re on a type of Ubuntu or Debian Linux, run these commands:
sudo apt-get update
sudo apt-get install wgetInstall Wget on Windows
The easiest way to use Wget and similar tools on Windows is to use WSL and then follow the instructions for installing wget on Linux.
How to Download an Entire Website Using Wget
To download a website with Wget, use the following command in a terminal, replacing example.com with the domain name of the site you want to download.
Warning: This command will download an entire website. Be respectful of how much bandwidth it might use when fetching a large number of pages.
wget -m -k -K -E https://example.com/
After the command runs, you should see a directory with the name of your site. The files will be in there.
How the Command Works
The name of the command is wget. Each of the letters that begins with a dash is called a flag. Here’s what those specific flags do:
-m— this turns on options that help Wget mirror the website.-k— this converts links within the pages so that they can be viewed locally.-K— this backs up the original downloaded files so that you have both the original files and the copies with the converted links. The original files will have.origappended to the filenames.-E— this converts the file extensions of web pages to.htmlso that the files can be easily viewed in a browser.
You can read more details about the options on Explain Shell.
There are additional settings that can be viewed by typing man wget in a terminal.