Curl Stands for “Client URL”. It is a command-tool that allows you to transfer data to and from a server. Curl is available in many Linux distributions and macOS systems. It supports various protocols like HTTP, HTTPS, FTP, and more, making it a versatile tool for testing APIs, downloading files, automating web scraping tasks, etc.

In this guide, I will provide an overview of curl and how to use it through a cheat sheet of common examples and use cases.

Curl features

Some key features and capabilities of curl include:

Now that you know what the curl command is and what it is used for let's look at some common examples on how to use it.

Basic Operations

These are some of the basic ways to use curl to fetch a URL or download a file from the internet/remote servers.

Fetch a URL:

To fetch a url, you just pass the url as argument to the curl command. Here is an example:

curl http://example.com

This will make a GET request to the given URL and print the response to standard output (stdout). It is the simplest usage of curl to retrieve data from a remote resource.

Download a File:

To download a file from a remote server and save it you use the -O option:

curl -O http://example.com/file.zip