wget
How To

How to Install and Use Wget on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

So you were following one of our tutorials which involves the usage of wget to download some files and you got an error like this:

Command wget not found

"Command 'wget' not found, but can be installed with:"

It means the wget package is not present in your system so what should be your next step? Of course, installation!

How to install wget in Ubuntu

wget is available in the Ubuntu repositories. You can install it with this simple command:

sudo apt install wget

And to make sure the installation was successful, you can use the given command to check for the installed version:

check wget version in ubuntu

How to use Wget in Ubuntu

After installation, I'd like to walk you through some basic examples of wget so you can have a better idea of its use case.

How to download Files using wget

To download files using wget, you just have to follow the simple syntax as follows:

wget Download_URL

So I wanted to install Pop!_OS Linux so why not download its ISO using wget?

download files using wget

How to download files with specific filename

I often find the default filenames too long and irrelevant for my usage but wget allows you to choose the filename of your choice even before the download starts!!

And that can be achieved through the given syntax:

wget -O [file_name] [URL]
download files with specific filenames using wget

How to download files to a specific directory

To download files in a specific directory, users are required to use -P and appending the path where you want to save the file.

Sound complex? here's the syntax:

wget -P [Path_to_save_file] [URL]

Let's say I want to download a png file inside the directory named Images then my command will be:

download files in specific directory using wget

How to resume downloading after interruption

Suppose you were about to complete a download file worth 50-60 gigs and suddenly due to a network issue, the process gets interrupted.

I can't resolve network issues of your system but I show you a way how to resume downloads using wget through simple syntax:

wget -c [URL]

For example, I'll be resuming the download of Pop!_OS:

resume download using wget

How to download files in the background

To download files in the background, you just have to pair wget with -b option and your output will be stored at wget-log.

wget -b [URL]
download files in background using wget

And in the case where you want to monitor the download process, you can use the tail command with -f option:

tail -f wget-log
monitor background download using tail command

Final Words

So you can download files using wget but curl can do the same right? so what's the difference? Well, here's the answer:

What’s the Difference Between curl and Wget?
curl and Wget are widely used for downloading files from the web in the Linux terminal. So, what’s the difference and which one is better?

Through this guide, I explained how you could install and use wget command in Ubuntu.

And if you have any queries, feel free to ask in the comments!