Summery: Curl Vs Wget: What’s the Difference & How to Use Them

In windows when ever you wanted to download anything, the first thing that comes into your mind is your download manager. Similarly, if you wanted to directly download anything from a Linux command line Curl and Wget are the two main utilities that immediately comes into our mind.

Even though these two utilities share similar features, they aren’t same.

Similarities of Curl and Wget

Both of them have ability to download things. In other words, they can make requests to the internet and pull back the requested item. These two utilities also have the ability of making POST requests. Both of them are command line tools that can download contents from FTP or HTTP(s). And also both of these tools are 100% open source tools.

Differences between Curl and Wget

Even though both of these utilities perform same task, there are some differences between these two.

One of the main advantages that Wget has when compared with Curl is that it has the ability to download recursively.

Another plus point in Wget is that it is a single self-contained program which means it doesn’t require any extra libraries. But in the other hand Curl includes a library known as “libcurl”.

When we compare the protocols supported by these two, Curl supports lot more protocols than Wget. For example, Curl supports SCP, SFTP, TFTP, TELNET, LDAP(S), FILE, POP3, IMAP, SMTP, RTMP and RTSP. IN the other hand Wget only support FTP, HTTP and HTTPS.

How to use Curl and Wget

How to Download a File Using Wget

Following command will download the index file of website and stores in the same name as the remote server.

Downloading file using Wget

You can use “-O” flag to specify a Custom name to your save file. So that the downloaded file will have a different name than the remote server.

wget -O test.html
Downloading a file using Wget with a custom name

Using Curl in Linux

Some Linux distributions does not have curl pre-installed. In case if you own one of those distributions you can easily install Curl using the below command.

sudo apt install curl
How to install Curl in Linux

Viewing the request and response header using curl

You can use the flag “-v” to view the request and response headers.

curl -v
How to view request and response headers using curl

Also Read: How to Use Wildcards in Linux Explained

How to Download a File Using Curl

You can use the below command to download a file using curl. The flag “-L” specifies the location.

curl -L

But by running the above command will start dumping the downloaded file on the stdout. Which means it will display in the terminal.

Downloading a file using curl

If you want to save the output in a file you can redirect the output in to file.

Redirect the curl output in to file.

While downloading the file curl will display some useful information related to the download.

Also Read: How to Use GZIP Command in Linux

Download Information
  • % – Percentage of the download that was completed.
  • Total – Total size of the download
  • Received – Total size that has been downloaded so far.
  • Xferd – This will show the total size of the file that has been uploaded so far during a file upload process.
  • Average Speed Dload- Average download speed.
  • Average Speed Upload – Average upload speed.
  • Time Total – This indicates the total time it will take to download base on the current internet speed.
  • Time Spend – The time curl has spent so far downloading (or uploading) the file.
  • Time Left – “Time Total” – “Time Spent”.
  • Current Speed – This indicates the current download/upload speed.


Leave a Reply

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