WGet command to download a file

Last Updated On Sunday 3rd Oct 2021

wget Output File

  • Wget command helps to download number of packages from web.
  • Wget supports https, http and ftp protocols.
  • You can download packages very easily even if your net connection is very slow.
  • Wget is best suitable for very slow and unstable network connections.
  • Support SSL/TLS It supports encrypted download through SSL/TLS.
  • Download through proxies It can download through proxies and have web access through inside firewall.

To Install

	apt-get install wget

dpkg -i wget
	

How to download a zip file via http. You can download any file with wget.
For Example , Download the latest wordpress zip

Wget Save As

	wget http://wordpress.org/latest.zip
	
  • With wget command you can also resume your downloads.
  • You may be downloading any package and for some reason you had to stop your download.
  • You can again restart the download from the same place where it was stopped.

wget FileName

	wget -O cj.zip http://wordpress.org/latest.zip
	

Check if the file exist

  • Just want to determine wheather the remote file exist at the destination then use spider option with wget.
	wget --spider http://wordpress.org/latest.zip
	

wGet Version

  • To know your wget version.
	wget version
	

wget to file

  • Download only only PDF files from specific domains.

Download full contents of website.

	wget -m --domains=example.org, a.example.org, b.example.org, c.example.org -A=pdf http://www.example.org/
	

wGet download file

	wget -nd -r -P /Downloads/ -A jpeg,gif,png http://www.examples.com/imgs/
	

wget Examples of Image Download

  • -P Prefix directory it set the path where all the downloaded files and directories will be saved.