Skip to content

5 Wget Examples to Download Files on Linux Command Line

Download Files through Command line Linux, wget is widely used for downloading files from Linux command line. There are many options to download a file.

On this page

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.

Tip 1: Download File using Wget

Below example will download file from server to current local directory.

$ wget https://tecadmin.net/file.zip

Tip 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://tecadmin.net/file.zip -O /opt/file.zip

Tip 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.tecadmin.net/file.zip

Tip 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.

Tip 4.1: Download file from Password protected ftp server.

$ wget --ftp-user=username --ftp-password=secretpassword ftp://ftp.tecadmin.net/file.zip

or

$ wget ftp://username:secretpassword@ftp.tecadmin.net/file.zip

Tip 4.2: Download file from password protected http server.

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

Tip 4.3: Download file behind password protected proxy server.

$ wget --proxy-user=username --proxy-password=secretpassword https://tecadmin.net/file.zip

Tip 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://tecadmin.net/file.zip  --no-check-certificate

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

2 Comments

Leave a Reply

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


Back to top