Transfer data to or from a server using HTTP, HTTPS, FTP, and more.
low risk
curl is the Swiss Army knife for HTTP. -I sends HEAD request (headers only). -o saves to file. -s enables silent mode. -X sets the HTTP method. Essential for API testing, downloading files, and debugging web requests.
| Flag | Meaning |
|---|---|
-I --head | Fetch HTTP headers only (HEAD request) |
-o --output | Write output to a file |
-L --location | Follow HTTP redirects |
-s --silent | Silent mode — no progress bar |
-X --request | Specify HTTP method (GET, POST, PUT, DELETE) |
-H --header | Add a custom HTTP header |
-d --data | Send POST body data |
-k --insecure | Skip SSL certificate verification (testing only) |
curl -I https://example.comCheck HTTP response headers and status code · explain & risk-check →curl -X POST -H 'Content-Type: application/json' -d '{"key":"val"}' https://api.example.com/dataSend JSON POST to a REST API endpoint · explain & risk-check →curl -fsSL https://get.docker.com | bashDownload and execute Docker install script · explain & risk-check →Check HTTP status codes in scripts: `curl -w '\n%{http_code}' -s -o /dev/null https://url` — no download, just the status.
Reference text is hand-written and may be incomplete — check man curl for your version. Test destructive commands on a non-production system first.