How to Download Files on Ubuntu Using Wget

  • Post category:Ubuntu

If you’re looking for a fast and reliable way to download files from the web on Ubuntu, the Wget command-line utility is an excellent tool. Wget allows you to download files directly from the terminal, making it ideal for users who prefer working in the command-line environment.

In this guide, you’ll learn how to install Wget and use it for downloading files from the internet.

Step 1: Install Wget

First, ensure that Wget is installed on your system. If not, you can easily install it by following these steps:

1. Open Terminal

To open the terminal, press Ctrl + Alt + T or search for “Terminal” in your applications menu.

2. Update Package List

Before installing any new software, it’s a good practice to update your package list:

sudo apt update

3. Install Wget

Install Wget by running the following command:

sudo apt install wget

4. Verify Installation

Check if Wget was installed correctly by verifying its version:

wget --version

You should see the installed version of Wget, confirming that the installation was successful.

Step 2: Downloading Files with Wget

Once Wget is installed, you can start downloading files from the internet.

Basic Usage

To download a file from a URL, use the following command:

wget [URL]

For example:

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

This command downloads the file to your current working directory.

Saving to a Specific Directory

To save the downloaded file to a specific directory, use the -P option:

wget -P /path/to/directory https://example.com/file.zip

Replace /path/to/directory with your desired destination.

Renaming the Downloaded File

You can also rename the file during the download process using the -O option:

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

This command saves the file as newfilename.zip.

Step 3: Advanced Options

Wget offers several advanced features that make it a versatile tool for managing downloads.

Resuming Interrupted Downloads

If a download gets interrupted, you can resume it using the -c option:

wget -c https://example.com/largefile.zip

Limiting Download Speed

To control the download speed and avoid consuming too much bandwidth, use the --limit-rate option:

wget --limit-rate=1M https://example.com/file.zip

This example limits the download speed to 1 MB per second.

Downloading in the Background

If you want to download files in the background, use the -b option:

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

The output will be saved in a log file named wget-log.

Conclusion

Wget is a powerful and flexible tool for downloading files from the web, offering various options to manage downloads effectively. Whether you need to download large files, work with limited bandwidth, or manage multiple downloads in the background, Wget has you covered.

For more tips and tutorials on using Ubuntu efficiently, visit codeallow.com.