-->

Wget Linux Command to Download Files

Author Piyush Gupta

wget is Linux command line utility. wget is widely used for downloading files from Linux command line. There are many options available to download a file from remote server. wget works same as open url in browser window.

1: Download File using wget

Below example will download file from server to current local directory.
$ wget https://example.com/file.zip

2: Download File & Save to Specific Location

Below command will download zip file in /opt folder with name file.zip. -O is used for specify destination folder
# wget https://example.com/file.zip -O /opt/file.zip

3: Download File from FTP

Some time you required to download file from ftp server, so wget can easily download file from ftp url like below.
# wget ftp://ftp.example.com/file.zip

4: Download File from Password Protected URLs

Sometimes we required to specify username and password to download a file. While using browser its easy but using command line it doesn’t prompt for login credentials. Below examples will show to how to use username,password while downloading files from password protected sources.

4.1: Download file from Password protected ftp server.

$ wget --ftp-user=username --ftp-password=secretpassword ftp://ftp.example.com/file.zip
or
$ wget ftp://username:secretpassword@ftp.example.com/file.zip

4.2: Download file from password protected http server.

# wget --http-user=username --http-password=secretpassword https://example.com/file.zip
or
# wget --user=username --password=secretpassword https://example.com/file.zip

4.3: Download file behind password protected proxy server.

$ wget --proxy-user=username --proxy-password=secretpassword https://example.com/file.zip

5: Download File from Untrusted Secure URL.

If any download url is using untrusted ssl certificate, wget will not download that file. But we can download it by using –no-check-certificate parameter in url.
$ wget  https://example.com/file.zip  --no-check-certificate

No comments:

Post a Comment