Wget utility used for download files from the web, It support protocols like, HTTP, HTTPS, FTP. The wget installed in build Linux / Unix and Mac operating system, if you could not found that package can be installed manually. Wget has developed for robustness or managing unstable network connection problem.
1. How to Install?
If you could not found the wget command on terminal try to install in single command,
For ubuntu/Debian
# apt-get install wget
For CentOS, Fedora, RHEL
# yum install wget
2. Find wget command location?
Both command can shows installed location and executable file
# which wget
/usr/bin/wget
# whereis wget
wget: /usr/bin/wget /usr/bin/X11/wget /usr/share/man/man1/wget.1.gz
3. Download single file:
For download a file give wget with that URL, Once enter the command file will be downloaded and display information about file length, download time duration, Total file space and completed status(100%).
# wget http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz
If you could not download the files give single quote 'URL'
# wget 'http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz'
4. Download file with --no-check-certificate
You may get an error when you downloading a files from the https URL for Unable to establish SSL connection. Run the command with option --no-check-certificate.
# wget https://pypi.python.org/packages/source/t/trash-cli/trash-cli-0.12.9.14.tar.gz
ERROR: certificate common name `*.a.ssl.fastly.net' doesn't match requested host name `pypi.python.org'.
To connect to pypi.python.org insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
# wget --no-check-certificate https://pypi.python.org/packages/source/t/trash-cli/trash-cli-0.12.9.14.tar.gz
5. Save the downloaded file in different name:
Do you like to save different file name give the -O option.
# wget http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz -O tomcat-8.0.11.tar.gz
6. Continue the Incomplete Downloading file :
If a download file fails due to a network problem, -c option keep retrying to download until file has been retrieved. This option same like as a torrent tool.
# wget -c http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz
7. Download Multiple file in a command:
Just give the space between the URL for download multiple files.
# wget http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz http://www.domainname.com/filepath/download.txt
8. Download a file in background.
May be a download file have more space retrieves in background using -b option and the status stores in wget-log file.
# wget -b http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz
Continuing in background, pid 14119.
Output will be written to `wget-log'.
Do you want to see the download current status give the below command,
# tail -f wget-log
3400K .......... .......... .......... .......... .......... 38% 293K 16s
3450K .......... .......... .......... .......... .......... 38% 521K 16s
3500K .......... .......... .......... .......... .......... 39% 488K 16s
3550K .......... .......... .......... .......... .......... 40% 331K 15s
8950K .......... .......... .......... .......... ... 100% 1.67M=27s
2014-08-26 15:23:58 (330 KB/s) - `apache-tomcat-8.0.11.tar.gz' saved [9209021/9209021]
9. Set Downloading Speed:
-o option set log for download status
--limit-rate option to set download speed
# wget -o wget-log --limit-rate=50k http://www.dsgnwrld.com/am/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz
View downloading logs
# tail -f wget-log
900K .......... .......... .......... .......... .......... 10% 52.1K 2m41s
950K .......... .......... .......... .......... .......... 11% 39.1K 2m42s
1000K .......... .......... .......... .......... .......... 11% 52.1K 2m40s
1050K .......... .......... .......... .......... .......... 12% 52.1K 2m39s
1100K .......... .......... .......... .......... .......... 12% 52.1K 2m38s
1150K .......... .......... .......... .......... .......... 13% 52.1K 2m36s
Do you want to set background process give & symbol end of command,
10. Get download log, background and speed limit:
# wget -b -o wget-log --limit-rate=10k http://www.domainname.com/filepath/file.txt
11. Download multiple file from the url from text file:
Open a text file and add URL's
# vi urlfile.txt
http://domainname1.com/filepath/file.txt
http://domainname2.com/filepath/file.txt
http://domainname3.com/filepath/file.txt
http://domainname1.com/filepath/file.txt
http://domainname2.com/filepath/file.txt
http://domainname3.com/filepath/file.txt
Finally, save and execute the below command:
# wget -i urlfile.txt
12. More wget help:
#wget --help
Comments (0)