Beginner Package: curl

curl

Transfer data to or from a URL — HTTP, FTP and more.

Syntax

curl [options] url

Description

curl fetches or sends data to a URL from the command line, supporting HTTP, HTTPS, FTP and many other protocols, and is a standard tool for testing APIs, downloading files, or scripting web requests.

Examples

curl https://example.com
Fetch a URL and print the response body
curl -O https://example.com/file.tar.gz
Download a file, saving it with its original name
curl -I https://example.com
Fetch only the HTTP response headers
curl -X POST -d '{"key":"value"}' -H "Content-Type: application/json" https://api.example.com
Send a JSON POST request

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux

Put it into practice

Learn this in context