Javatpoint Logo
Javatpoint Logo

GNU Wget

Wget is a free GNU command-line software that is used to download the data and files from the web servers (Internet). It is a part of the GNU Project. It uses the HTTP, HTTPS, and FTP protocols to download the contents and data. If the download fails due to certain problem, it resumes the file where it was left.

GNU wget works as a tool that helps you to manage weak and unreliable network connections. It allows you to resume downloads, download multiple files, perform recurring downloads, limit bandwidth, mirror a website, download in the background, and more.

Features of the GNU Wget

  1. GNU wget accepts NLS-based message files for different languages.
  2. GNU wget works on most UNIX-like OS and Microsoft Windows OS.
  3. It uses REST and RANGE for resumed downloads.
  4. It can use the recursive mirror directory and the wildcard filename.
  5. It supports HTTP cookies.
  6. It supports persistent HTTP connections.
  7. It supports HTTP proxies.
  8. It converts all links into relativity in downloaded documents, so that you can connect them to each other locally.
  9. If the documents need to be downloaded again, it uses local file timestamps.

How to check whether the GNU wget package is installed or not?

Mostly, the "wget package" comes pre-installed on the Linux Operating System.

Step 1: Open the terminal window.

Step 2: Then, type "wget".

If your system have installed "wget package" , the output tells you that the wget command is missing a URL, as shown in the screenshot below.

GNU Wget

If your system do not have the "wget package" installed, you will have to manually download and install the wget package.

Installation process of the GNU wget for Linux operating system

To install the wget package on the Linux operating system, use this command:


GNU Wget

Installation process of the GNU wget for CentOS/Fedora operating system

To install the wget package on the CentOS/Fedora operating system, use this command:

Installation process of the GNU wget for windows operating system

Follow these steps to install the wget package on Windows OS.

Step 1: Click the following link to download the GNU wget exe file (https://eternallybored.org/misc/wget/)

Step 2: Download the exe file according to your window.

GNU Wget

Step 3: Copy the exe file and paste it from this path (C:\Windows\System32).

Step 4: Open the CMD and start running wget commands.

GNU Wget

Syntax of the wget command:

The wget syntax has the following pattern:

  1. [Option] specifies the attribute that follows the URL.
  2. [URL] is the address of that file you want to download

Basic Commands

1. Download a file

Example


GNU Wget

2. Download a file with specific name

This command allows you to change the file name before downloading the file to your system. The syntax of this command is:

Example


GNU Wget

3. Download a file to the specific location

GNU wget downloads the file to the user directory by default. If the user saves the file to a specific location, add the -P option. The syntax of this command is:

Example


GNU Wget

4. Download Multiple Files

If you want to download multiple files at once, add the -i option.

The syntax of this command is:

Step 1: To download the multiple files, you will need to create a text file and place all the URLs in the text file that you want to download. Each URL must be on a separate line.

Step 2: Save the text file.

GNU Wget

Example

5. Set download speed according to the user

The user can set the download speed of a file. The download speed of the file is defined in mb (m) and kb (k). The syntax of this command is:

Example


GNU Wget

6. Download a large file in the background

If the user wants to download the large file in the background, add the -b option. The syntax of this command is:

Example


GNU Wget

7. Continue download after interrupt

If you are downloading a big file and it fails in any way, you can continue the download the file using the "-c" option in most situations. The syntax of this command is:

Example


GNU Wget
Next TopicStatistics MCQs




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA