Linux cURL Commands: Quick Tutorial [Updated 2024]

cURL is a command-line interface tool used to download data from the internet. It is free to use, open-source,  developed, and maintained by thousands of contributors from all over the world. It supports numerous protocols such as HTTP, HTTPS, DICT, FILE, FTP, FTPS, Gopher, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet, and TFTP. Refer official website (https://curl.haxx.se/) for more details.

Linux cURL Commands: Quick Tutorial

Click Here for Top 25 Linux Commands for Beginners

(1) Download content of the url

#curl https://allabouttesting.org

(2) To save the content of the url in the html file

#curl https://allabouttesting.org > test.html

It also shows statistics related to the downloading speed of the content test.html of url. You can easily check the content of test.html by using cat command.

Alternatively, you can use the below command to save the content of url.

#curl -o test.html https://allabouttesting.org/what-is-unified-threat-management/

(3) Download pdf, iso image, installer file etc. from the URL.

In below example, we have downloaded the user manual of curl command available on official website.

#curl -o test https://legacy.gitbook.com/download/pdf/book/bagder/everything-curl

Note: Remember we can also use wget command to download the file from the internet.

(4) To see the weather report of your city

#curl http://wttr.in/delhi

(5) Download content of multiple urls at the same time

#curl -o file1 www.google.com -o file2 www.yahoo.com

(6) To check the header information of the URL

#curl -I www.google.com

(7) To continue/resume the previous download

Assume you are downloading an official usage guide of curl command. Somehow it got canceled in the middle, you can continue downloading by using -C option as mentioned below.

#curl -0 everything-curl https://legacy.gitbook.com/download/pdf/book/bagder/everything-curl

Somehow it got canceled in the middle, you can continue downloading by using -C option as mentioned below.

#curl -o everything-curl -C  - https://legacy.gitbook.com/download/pdf/book/bagder/everything-curl

(8) To control the download speed of the file

#curl --limit-rate 1000B -o filename https://legacy.gitbook.com/download/pdf/book/bagder/everything-curl

(9) To enable the verbose mode

#curl -v www.google.com

(10) To interact with API endpoints

Below example, you can get information regarding ip address by using ipinfo.io

#curl ipinfo.io/X.X.X.X

X.X.X.X denotes the ip address.

Subscribe us to receive more such articles updates in your email.

If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!

Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.

You may also like...

Leave a Reply

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

10 Blockchain Security Vulnerabilities OWASP API Top 10 - 2023 7 Facts You Should Know About WormGPT OWASP Top 10 for Large Language Models (LLMs) Applications Top 10 Blockchain Security Issues