Curl is a command line utility that was created in 1998 for transferring data using URLs. Fundamentally, curl
allows users to create network requests to a server by specifying a location in the form of a URL and adding optional data.
curl
(short for “Client URL”) is powered by libcurl – a portable client-side URL transfer library written in C.
Why use the curl command?
Common use cases for curl
include:
- It can download and upload files
- It has great error logging
- It allows for quick endpoint testing
- It provides granular details which aides debugging
- It is portable and works with most operating systems
- It is an actively managed open-source tool that is battled tested with a large user base
Base curl
command usage
The basic syntax for a curl
command is:
|
|
Perform a GET
request
The simplest usage is a default GET
request for a website or API:
|
|
Output:
|
|
Download a file
Downloading a file using the same name as the remote server:
|
|
Downloading a file and specifying a new name:
|
|
Conclusion
curl
is a powerful and versatile command line utility that offers a wide range of supporting features: multiple protocols, multiple options, data types, etc.