Skip to content

What is cURL

Developers will often spend a lot of time using the terminal window and will often need to download or transfer files and data across the internet or even connect to an API and perform some action. Using a tool like cURL enables you to do these kinds of tasks without even have to leave the terminal window.

cURL is a free command line tool, available in most Package Manager Repositories. It uses URL syntax to transfer between computers. curl is a widely used because of its ability to be flexible and complete complex tasks. For example, you can use curl to test API's, authentication, SSL connections, proxy support, FTP uploads, and more! You can also do simple things with curl, such as download files, web page or even images.

With curl, you can download or upload data using one of the supported protocols:

  • HTTP
  • SCP
  • DICT
  • FILE
  • FTP
  • FTPS
  • IMAP
  • LDAP
  • POP3
  • RTMP
  • RTSP
  • SCP
  • SMB
  • SMBS
  • TFTP

How to install cURL

cURL may already be installed and shipped by some distributions of Linux, to check if curl is already installed simply check the version.

curl --version

If curl is not present on your system, your system will display and error message indicating that it could not find the command curl else your system will respond as follows:

If curl is not installed on your system, then in most Linux Distributions it will be available in the default package repositories and should be easily installed using you favourite package manager.

Install curl Debian based distributions

# update the repositories and upgrade 
sudo apt update && sudo apt upgrade -y
# Install CUrl
sudo apt install curl

Install curl RPM based distributions

# update the repositories and upgrade
sudo dnf update && sudo dnf upgrade -y
# Install CUrl
sudo dnf install curl

Once curl you can access the manual pages from the command line using

curl --man

How to use cURL

In Advanced git configuration options we touched a typical use case where you may want to use cURL. In that use we wanted to download a file to our system and rename the file to a different name on our system, which we achieved in one line, without having to leave the terminal window.

# Download a file from Github and rename it to git_autocomplete on our system
curl -o .git_autocomplete

This is a typical use case for developers to use curl. Its quick, lightweight and gets the job done without having to leave the terminal window.

You can obviously use cURL to do more complex tasks. For instance, lets do a verbose trace connection trace on the Gary Woodfine

curl -v

Another common task software developers may use curl for is to download files from password protected FTP sites



curl is a powerful, flexible tool, well worth getting to know. The commands we've highlighted in this article are just as small fraction of common use cases software developers will make use of curl of on a day to day basis.

curl provides the ability to interact with a number of protocols, and once you start getting more familiar with using the tool you'll find it becomes an indispensable tool in your toolbox.

Gary Woodfine
Latest posts by Gary Woodfine (see all)