Home » Linux » The Differences between wget vs curl

About Yatin

Avatar photo
An experience full-stack engineer well versed with Core Java, Spring/Springboot, MVC, Security, AOP, Frontend (Angular & React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).

The Differences between wget vs curl

Hello. In this tutorial, we will take a look at the wget vs curl commands actively used in Linux.

1. Introduction

1.1 What is wget

wget in Linux is a command-line utility to download things from the internet. It helps to retrieve things using different protocols such as HTTP, HTTPS, and FTP. This command serves as a tool to sustain unstable and slow network connections i.e. if during download the network interrupts the command is helpful can resuming the download without starting from scratch. It is represented by the below syntax –

Syntax

wget [options] [URL…]

Where option and url represent the wget options and url of the item that we want to download respectively.

1.1.1 How to install wget command?

In most Linux distributions the wget command is pre-installed and you can check it by typing the wget command in the terminal. If installed the system will print the below log on the screen.

wget: missing URL

If not the system will print the wget command not found error message on the screen. To install the wget utility on the system follow the below command. For Ubuntu or Debian systems follow –

sudo apt install wget

While for CentOs or Fedora systems follow –

sudo yum install wget

Once done you can trigger the wget command to verify whether the command utility was successfully installed or not.

Fig. 1: wget command

1.2 What is curl?

curl in Linux is a command-line utility for transferring data from or to a server designed to work without user interaction. It offers to transfer data over different protocols e.g. HTTP, HTTPS, FTP, SCP, and SFTP. This command provides options to resume transfers, limit the bandwidth, proxy support, user authentication, and much more. It is represented by the below syntax –

Syntax

curl [options] [URL...]

Where option and url represent the curl options and url of the item that we want to download respectively.

1.2.1 How to install curl command?

In most Linux distributions the curl command is pre-installed and you can check it by typing the curl command in the terminal. If installed the system will print the below log on the screen.

curl: try 'curl --help' or 'curl --manual' for more information

If not the system will print the curl command not found error message on the screen. To install the curl utility on the system follow the below command. For Ubuntu or Debian systems follow –

sudo apt install curl

While for CentOs or Fedora systems follow –

sudo yum install curl

Once done you can trigger the curl command to verify whether the command utility was successfully installed or not. You can also run the curl --version to check the version of the installed utility.

Fig. 2: curl command

2. Demonstration

Let us take a look at the practical implementation of wget and curl commands.

2.1 wget command examples

Let us use the wget command in one of its simplest forms. We will use the below command to download the stuff from the internet into the system’s current working directory.

Command 1

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.17.2.tar.xz

If everything goes well the following output will be shown.

Fig. 3: Download from the internet using wget

To turn off the output from the above command use the -q option. If the downloaded file already exists in the current working directory the command will add the .N (number) at the end of the file name.

Command 2

wget -q https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.17.2.tar.xz

If everything goes well the following output will be shown.

Fig. 4: Seeing the use of a number and quiet flag in the wget command

Similarly, you are free to play around with the different other commands provided by this utility.

2.2 curl command examples

Let us understand the curl command in one of its simplest forms. By entering the command in the terminal you will get the contents of the file.

Command 1

curl https://ubuntu.com/download/desktop

If everything goes well the following output will be shown where you will see the HTML code of that specific website.

Fig. 5: curl command output

Similarly, you are free to play around with the different other commands provided by this utility.

3. Similarities between wget and curl command

The following points list the similarities between wget and curl command.

  • Both support different protocols e.g. HTTP, HTTPS, and FTP
  • Both can download files from the internet
  • Both support HTTP cookies and can transfer the output to a file
  • Both support resume transfers
  • Both are available for free license and are actively developed by the community

4. Difference between wget and curl command

The following points list the difference between wget and curl command.

  • wget is a transfer utility while curl is much more than that
  • wget command support fewer protocols than the curl command
  • The recursive download is not supported in curl command
  • Only curl command supports multiple parallel transfers
  • curl command supports bidirectional http while wget offers a plan http post
  • curl command supports a larger number of http authentication methods as compared to wget
  • curl command provides transfer-encoded http decompressions while wget not

That is all for this tutorial and I hope the article served you whatever you were looking for. Happy Learning and do not forget to share!

5. Summary

This tutorial focused on the brief introduction, similarities, and differences between the wget and curl command. From the industry, curl command is favorably considered but there are instances where wget command is also recommended. You can download the above commands from the Downloads section.

6. Download the Project

This was a tutorial on wget vs curl command in Linux

Download
You can download the sample commands from here: What is the Difference Between wget vs curl?

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments