curl — transfer data with URLs

The terminal's web browser — and its API client, downloader, and debugger.

Every API you have ever called from a browser was probably tested first with curl — the tool that has shipped with every Unix-like system since 1997 and still has no real rival for talking to a server from a terminal.

What it does

curl transfers data to or from a server using a URL. It supports HTTP, HTTPS, FTP, SFTP, and a dozen other protocols, but in practice you use it for one thing: making HTTP requests from the command line. Give it a URL and it fetches the response and prints it to your terminal. Give it -X POST and a body and it sends data instead. It is the Swiss-army knife of talking to servers.

Why it matters

curl is how you test an API without opening a browser, download a file without a GUI, check whether a server is actually responding, and debug what a web request really sends and receives. When a website 'doesn't work', curl is the tool that tells you whether the problem is the network, the server, or the app. And because it is scriptable and present on every Unix box, it is the backbone of countless shell scripts and CI pipelines.

Examples

curl -s -o /dev/null -w "HTTP %{http_code} | %{size_download} bytes | %{time_total}s\n" https://example.com
HTTP 200 | 559 bytes | 0.273114s

-s silences the progress bar, -o /dev/null discards the body, and -w prints a custom summary. This is the canonical 'is this site up and how fast?' one-liner. (Verified live on this box.)

curl -s https://api.github.com/repos/curl/curl | head -c 200
{
  "id": 17252002,
  "node_id": "MDEwOlJlcG9zaXRvcnkxNzI1MjAwMg==",
  "name": "curl",
  "full_name": "curl/curl",
  "private": false,
  "html_url": "https://github.com/curl/curl",
  "description": "A command line tool and library for transferring data with URLs",
  "fork": false,
  "url": "https://api.github.com/repos/curl/curl"
}

A GET request to a JSON API. curl prints the raw response body — here, GitHub's repo metadata as JSON. Pipe it into jq to pretty-print and extract fields.

curl -s -o /dev/null -w "%{http_code}\n" -X POST -H "Content-Type: application/json" -d '{"name":"test"}' https://httpbin.org/post
200

-X POST sends a POST request, -H adds a header, -d sends a JSON body. The -w '%{http_code}' prints just the status code, which is how scripts check whether an API call succeeded.

curl -s -I https://example.com
HTTP/2 200 
date: Thu, 10 Sep 2026 07:00:45 GMT
content-type: text/html
server: cloudflare
last-modified: Sun, 30 Aug 2026 04:11:49 GMT
allow: GET, HEAD

-I sends a HEAD request, which fetches only the response headers, not the body. This is the fastest way to inspect a server's headers, caching, and content type. (Verified live.)

Flags

FlagMeaning
-ssilent — suppress the progress bar and error messages (essential for scripts)
-o FILEwrite the response body to a file instead of stdout (use -o /dev/null to discard it)
-Osave the body to a file named after the URL's last path segment (like wget)
-X METHODset the HTTP method explicitly, e.g. -X POST, -X PUT, -X DELETE
-H HEADERadd a request header, e.g. -H "Content-Type: application/json"
-d DATAsend data in the request body (implies POST); use -d @file.json to read from a file
-Isend a HEAD request — fetch only the response headers
-w FORMATprint a custom summary after the transfer, e.g. -w "%{http_code} %{time_total}s"

Origin

curl was born in 1996 when Swedish developer Daniel Stenberg wrote a small tool to fetch currency exchange rates from a web page. It started as 'httpget', then became 'urlget', and finally 'curl' — a play on 'see URL'. It grew from a one-off script into the most widely used command-line HTTP client in the world, and Stenberg still maintains it today.

The name and the reach

The name is a pun: 'curl' sounds like 'see URL'. The tool is so ubiquitous that it ships by default on essentially every Linux distribution, macOS, and Windows 10+ — and the underlying libcurl library is embedded in countless applications, browsers, and devices. When you use a package manager, a cloud CLI, or a smart device that talks to a server, there is a good chance libcurl is doing the talking.

Fun facts

Pros

Cons

Takeaways