Curl, Wget
Curl, Wget
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.
Wget
wget or GNU wget is another open-source free command-line tool for transferring files using
HTTP/HTTPS, FTP, and FTPS.
To install curl, enter the following command:
Example: In the following example, we will HTTP/HTTPS request through curl and wget and
download a website page.
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
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
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.
wget utility tool supports recursive downloading and we add the flag –recursive for that.
Terminal(Download in progress)
The files path added to robots.txt are ignored. To turn this feature off, add the -e flag as follows: