0% found this document useful (0 votes)
84 views

Curl, Wget

The document compares the wget and curl commands. It notes that both allow making HTTP requests from the terminal without a GUI. Curl supports more protocols than wget and has additional functionality through its libcurl library. Wget focuses on recursive downloading and bandwidth control while curl offers more general transfer and protocol support across operating systems. The document provides examples using wget and curl to download files and webpages over HTTP and FTP.

Uploaded by

Javeed Ahamed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Curl, Wget

The document compares the wget and curl commands. It notes that both allow making HTTP requests from the terminal without a GUI. Curl supports more protocols than wget and has additional functionality through its libcurl library. Wget focuses on recursive downloading and bandwidth control while curl offers more general transfer and protocol support across operating systems. The document provides examples using wget and curl to download files and webpages over HTTP and FTP.

Uploaded by

Javeed Ahamed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Difference Between wget VS curl

 Last Updated : 03 Jun, 2022

 Read
 Discuss

wget and curl are the commands that are used to HTTP requests without any GUI or software,
rather we use the Terminal in Linux that provides the respective output or message. The
commands are very useful for web crawling, web scraping, testing RESTful APIs, etc.

Curl
Curl is a free and open-source command-line utility tool that allows the users as well as the
developers to transfer data without any UI interaction. It is commonly used in routers, mobiles,
etc. 

Protocols Supported: HTTP/HTTPS, FTP, SFTP, SCP, IMAP, LDAP/LDAPS, SMB/SMBS,


TELNET, POP3, GOPHER, etc.

Wget
wget or GNU wget is another open-source free command-line tool for transferring files using
HTTP/HTTPS, FTP, and FTPS.

Features: Recursive downloads, Bandwidth control, Resumes aborted transfers, Background


downloads, Recursive mirror files, and directories, etc.

Install wget and curl


To install wget, enter the following command:

sudo apt-get install wget

 
To install curl, enter the following command:

sudo apt-get install curl

Example: In the following example, we will HTTP/HTTPS request through curl and wget and
download a website page.

Using the curl command, save a webpage.

curl https://geeksforgeeks.org -o geeks.html

Output: The file is downloaded as geeks.html


 

Using the wget command, save a webpage. 

wget https://practice.geeksforgeeks.org/jobs

Output
 

We have the jobs file from wget and geeks.html using the curl command.

Example 2:  In the following example, we will learn FTP protocol requests through curl and
wget and download files.

To download files from a domain name like the GeeksforGeeks logo from wget, use the
following command.

wget https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210420155809/gfg-new-
logo.png

The output is as follows:- 


 

Using the curl command, we can specify the name, for example, logo, and download as follows:

curl https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210420155809/gfg-new-
logo.png -o logo.png

The output is as follows:


 

curl also supports uploading files to the web. We need to add the flag -T to specify uploading.
We use the following command to upload files to any URL.

curl -T “geeks_logo.png” ftp://www.geeksforgeeks.org/upload/to/url/

Example 3: Recursive downloading

wget utility tool supports recursive downloading and we add the flag –recursive for that.

wget –recursive https://practice.geeksforgeeks.org/jobs


This command downloads all the related resources to a folder named at the web page URL. The
output is as follows:

Terminal(Download in progress)

Files and Folders downloaded


 

The files path added to robots.txt are ignored. To turn this feature off, add the -e flag as follows:

wget -e robots=off https://practice.geeksforgeeks.org/jobs

The documents downloaded are in form of breadth-first-search. But it can be overridden by


mentioning the depth by -l flag and setting the depth. The default maximum depth is 5.

wget ‐l=1 ‐‐recursive ‐‐no-parent https://practice.geeksforgeeks.org/jobs


 

Table of Difference between wget and curl


wget curl
wget is a simple transfer command-line curl has much more functionality. The libcurl library
utility. can be used as a GUI library.
Has more support to protocols. It supports
Limited support for different protocols.
bidirectional HTTP.
Recursive download supported. Other
features are Bandwidth control, Resumes
The recursive download is not supported.
aborted transfers, Background downloads,
Recursive mirror files, and directories, etc.
Wget supported protocols: HTTP, HTTPS, Curl-supported protocols: DICT, FILE, FTP, FTPS,
wget curl
Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
and FTP. LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP,
SMB, SMBS, SMTP, SMTPS, Telnet and TFT.
wget is more focused and available on Curl is available on multiple platforms with many
Linux operating systems. web utilities

You might also like