Commands.page Logo

How to Download Files Using HTTPS with Wget on Ubuntu

This article provides a concise guide on downloading files securely via HTTPS using the wget utility on Ubuntu Linux. It covers the basic command syntax, specifying output directories, and troubleshooting common SSL certificate errors directly from the terminal.

Install Wget

Wget is typically pre-installed on Ubuntu. If it is missing, open the terminal and run the following command to install it:

sudo apt update
sudo apt install wget

Basic Download Command

To download a file from an HTTPS URL, type wget followed by the link. The tool automatically negotiates the secure connection.

wget https://example.com/file.zip

Specify Output Directory

You can save the downloaded file to a specific folder using the -P option followed by the path.

wget -P /home/user/Documents https://example.com/file.zip

Rename the File

To save the file with a different name than the original, use the -O flag followed by the desired filename.

wget -O newname.zip https://example.com/file.zip

Handle Certificate Errors

If the server has an invalid SSL certificate, wget will refuse the connection. To bypass this check, use the --no-check-certificate flag.

wget --no-check-certificate https://example.com/file.zip

Verify the Download

After the process completes, list the files in your directory to confirm the download was successful.

ls -l