5 Wget Command Examples in Linux

Trend Oceans
3 min readJan 7, 2021

--

10 wget command examples

Recently, I have covered how to install wget in Linux with a few simple steps. So, many readers requested how do we implement these in the practical world.

Today, we cover 5 wget most used command in Linux. But if you directly jump to these posts or don’t know what we are talking about right now.

Let’s Begin

First, check whether wget is installed correctly in your system or not by typing the following command in your Linux terminal.

$ wget -V

If it outputs the version information, then you good to go or get a message something like command is not found; make sure to read our recent post on installing wget in all major Linux distribution and then continuing from here.

1. Download the contents of an URL to a File

To download webpages of any site over the internet. Simply, write it URL with wget, and it will download and save in the current location.

$ wget https://www.gnu.org/software/wget/
$ ls
index.html

2. Single file download

To download any files over the web, type the following command in your Linux terminal.

$ wget https://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz

To download a file in the background and access your terminal without waiting for the file to be downloaded.

$ wget -b https://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz
Continuing in background, pid 37170.
Output will be written to ‘wget-log’.
  • b: These parameters inform wget to download the file in the background and let the user have access to the terminal.

3. Download a file from an HTTP server with authentication

Downloading files without any authentication is easier using wget. But to download files using authentication is no more than a piece of cake.

$ wget --user=username --password=password https://example.com

--user: This option specify the user username to access a restricted area of the web page.

--password: This option is used to authenticate the user with the user username provided in --user.

In the above example, I have not mentioned any specific website because of privacy issues. But you can have access to your FTP server using this method.

4. Continue an incomplete download

Suppose you enter into a situation where the file size is more than 1024 to 2048GB, and it took several minutes to download the file.

Because of this, you are facing low speed while surfing on the webpage, and there is an urgency to have your actual speed back.

Don’t be said to cancel your download file. Simply press Ctrl+z and continue your download file, just passing the simple -c option when you are done with your work. It will continue where it is left last time.

$ wget -c https://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz

5. Download file recursively

If you are attempting to download a file, but for any reason, it is failing. Then you can download it using recursively. Most of the time, this solves the problem.

$ wget -r [URL]

Conclusion

Today I try to cover almost 5 important topics in wget. In this week I’ll add more wget command example make sure to bookmark this page or you can refer to TrendOceans for more get example

--

--

Trend Oceans
0 Followers

Get the latest Linux and open source related articles to help you become a better and more informed Linux user.