This article covers the wget command which downloads files served with HTTP, HTTPS, or FTP over a network. In fact, Wget is a free GNU command-line utility tool used to download files from the internet. It retrieves files using HTTP, HTTPS, and FTP protocols.
Wget command options includes:
- -V, --version: Display the version of wget, and exit.
- -h, --help: Print a help message describing all the wget's command-line options, and exit.
- -b, --background: Go to background immediately after startup. If no output file is specified via the -o, output is redirected to wget-log.
- -e command,
- --execute command: Execute command as if it were a part of the file .wgetrc. A command thus invoked is executed after the commands in .wgetrc, thus taking precedence over them.
How to Check if wget is Installed?
To check, open the terminal window and type in:
If the output displays wget command not found you need to download and install the tool manually. Below you will find the installation instructions for Ubuntu/Debian, CentOS, and Windows.
To install wget on Ubuntu or Debian releases, use the command:
$ sudo apt-get install wget
To install wget on CentOS or Fedora, type the following command:
$ sudo yum install wget
How to Install wget on Windows ?
- Download wget for Windows and install the package.
- Add the wget bin path to environment variables (optional). Configuring this removes the need for full paths, and makes it a lot easier to run wget from the command prompt:
- Open the Start menu and search for "environment".
- Select Edit the system environment variables.
- Select the Advanced tab and click the Environment Variables button.
- Select the Path variable under System Variables.
- Click Edit.
- In the Variable value field add the path to the wget bin directory preceded by a semicolon (;). If installed in the default path, add C:Program Files (x86)GnuWin32bin.
- Open the command prompt (cmd.exe) and start running wget commands.