wget is a Linux/UNIX command line file downloader. The wget is a free tool for non-interactive download of files from the internet. It supports HTTP, HTTPS, and FTP protocols to connect server and download files, in addition to retrieval through HTTP proxies. Linux tool wget is non-interactive, meaning it may function in the background, which enables the feature to use without login on the system for the user.
Within this informative article, we’ll discuss various cases of wget command to use.
Suggested Reading: Linux wget command help and Examples
Single file download
The wget utility simple downloads a single file and store it into the current working directory. This command also shows file size, downloading time, and download progress, as shown below.
Multiple file download
The wget tool allows us to download multiple files at once, here you can see how to download multiple files using wget command.
Save downloaded file with different name
To save the downloaded file with different name use “-O” option. Here in below example, I save the downloaded file “wget-guide-188.8.131.52.pdf” with the name “wget.pdf”.
Read download links from a file
Suppose you have to download multiple files more than 10 or 20. In this case, we have the option to write all downloading links into a text file and use single wget command to download all files, where all downloading links will automatically read from the file and downloaded into the current directory.
Resume partial Download File
Sometimes downloading get failed due to the big size of a file, or network disconnection. To avoid these use “-c” command line option with wget command.
By using the “-c” option you can resume download, so I recommended you whenever downloading big size file use “-c” to support resume for downloading files as shown below.
Download files in the background
You can use the wget tool with the “-b” option to send the process into the background immediately after starting the download.
Download files with given download speed
You have the option to use wget tool to download file with your desired speed; the only thing is your client and server network should support that speed.
To set download speed use “-limit-rate” option, as shown below.
Use wget with download retry attempts
You have the option to increase or decrease retry attempt for downloading files. You can set a retry attempt using “-tries” option, as shown below:
Redirect command execution logs into log file
When you execute a command in the background, it is useful if you are writing logs in a file for future reference.
The wget tool has capabilities to redirect logs in a file using the “-o” option, as shown below:
The above command writes all logs into the file “wget-download.log” in the current directory.
Download full website to mirroring site for offline view
You can download a full website with wget command, as shown below:
–mirror is used to mirroring a site
-p help to download all file to use website offline as online.
–convert-link is use to convert all links into a document for local viewing.
-P ./<save-directory> is to save all files into the “save-directory” path.
Exclude file types while downloading
When you use the wget tool to download files, you also have the option to exclude any file type from the downloading list using “—reject” option as shown below:
The above command will download all files located into “download” directory except any “png” files.
Set download quota with wget command
You can also set download quota with wget tool using the “-Q” option, as shown below:
The quota will never effect on single file download. It is only applicable when it goes into the recursive mode. So if you use above command, it will automatically abort download when the quota is exceeding.
Use username and password to download protected site or files
There is an option to pass username and password with wget command to download password protected files or site. It work on http and ftp both protocols with option “- -http-user”, “- -http-password”, “- -ftp-user”, and “- -ftp-password” relatively, as shown below:
How to find wget version
To know, which version of wget tool installed, use “- -version” option.
Get help for wget command on terminal
To know more about wget utility, use “- -help” option on the terminal.