curl

Send an HTTP request from the terminal

What it does

curl sends a request to an address and prints the response. On a server this is how you check that a site or API answers: curl http://localhost:3000/health. -I asks for the headers only, so you see the status code, redirects and caching.

-L follows redirects, -o <file> saves the response to a file, and -X POST with -d sends data. -v shows the whole exchange with the server, TLS included, which helps when something does not work.

Syntax

curl <url>
curl -I <url>
curl -L -o <file> <url>

Examples

Related commands

Practise · All commands