AppsCommandsInternetLinux

How to use wget command in linux

Wget (download manager) – The non-interactive network downloader.
GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.
Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved. If the server supports regetting, it will instruct the server to continue the download from where it left off. (man page)

How to use wget command

By default, Wget is very simple to invoke. The basic syntax is:

wget [option] [URL]

Whenever any downloading process is being carried out, wget will show:

  • Progress of the download in percentage
  • Amount of data downloaded
  • Speed of the download process
  • Time left to complete the download process.

1. How to download single file

The folowing example explan how to download single file from internet and stores in current directory:

# wget http://mirror.netcologne.de/mint/stable/15/linuxmint-15-cinnamon-dvd-64bit.iso
How to use wget command
wget download single file from internet

2. Downloading and saving single file width diferent name using wget -O:

Syntax:

wget -O [Preferred_Name] [URL]

Example:

# wget -O mint15_c64.iso http://mirror.netcologne.de/mint/stable/15/linuxmint-15-cinnamon-dvd-64bit.iso
Downloading and Saving the File with Different Name
Downloading and saving the file with different name

3. Wget how to limit download speed

Sintax:

# wget --limit-rate=[VALUE]  [URL]

Example:

wget --limit-rate=50k http://mirror.netcologne.de/mint/stable/15/linuxmint-15-cinnamon-dvd-64bit.iso

4. Reading a file for multiple downloads

If you need to download multiple files, then you will have to make a text file having the list of URLs of all those files to be downloaded. You can read the text file using option -i and start those multiple downloads using wget command.

Sintax:

# wget -i [downloadlist]

Example:
First, create a text file of all the URLs you want to download using wget and call it downloadlist.txt.

# nano downloadlist.txt

and add url download list:

http://example.com/file1.zip
http://example.com/file2.zip
http://example.com/file3.zip
http://example.com/file4.zip
...
http://example.com/file100.zip

Then to download URLs in bulk, type in this command:

# wget -i downloadlist.txt

5. Wget – download process in background

Wget run in the background ussing wget -b
Sintax:

# wget -b  [URL]

You can check the progress of the download process by reading the content of ‘wget-log’ file using tail command as follows:

# tail -f wget-log

6. Password Protected Wget

It’s possible to declare the username and password for a particular URL while using wget (wget –http-user=USER –http-password=PASS). This isn’t recommended on shared machines as anyone viewing the processes will be able to see the password in plain text.

wget --http-user=USER --http-password=PASS URL

7. Find wget version and help

With Options –version and –help you can view version and help as needed.

# wget --version
# wget --help

That’s all about basic wget command! More information find on wget man page. For any feedback, please use the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close