Commands · Command

CommandLinuxmacOS

curl

curl [options] url

Transfers data to or from a URL over the command line — the standard way to test an API endpoint or download a file from a script.

// FLAGS

-osave output to a file instead of printing it
-Ifetch headers only, no body
-Xspecify the HTTP method, e.g. POST
-Hadd a custom header
-vverbose — show the full request/response exchange

// EXAMPLE

curl -I https://example.com — prints just the HTTP response headers, a quick way to check a site's status code without downloading the whole page.

// GOTCHA

By default curl prints the response body straight to the terminal, which can flood the screen with raw HTML or binary data — redirect to a file (-o) or pipe through a formatter when the content isn't meant to be read directly.

// RELATED COMMANDS