curl
Transfer data to/from servers. Essential for testing APIs and debugging HTTP requests.
Synopsis
curl [options] [url]
Core Options
-X METHODHTTP method (GET, POST, PUT, DELETE).
-H 'Header: Value'Add custom headers.
-d 'data'Send data in request body.
-o fileWrite output to file.
-IFetch response headers only.
-LFollow redirects.
-u user:passBasic auth.
-sS -fSilent, show errors, fail on HTTP errors.
Usage Examples
GET JSON
Fetch JSON API response.
curl -sS https://api.github.comPOST JSON
Send JSON payload.
curl -X POST -H 'Content-Type: application/json' -d '{"name":"John"}' https://api.example.com/usersUpload File
Send multipart form data.
curl -F 'file=@report.pdf' https://api.example.com/uploadAuth Request
Basic authentication.
curl -u user:pass https://api.example.com/secureDownload with Redirects
Follow 3xx redirects and save file.
curl -L -o app.tar.gz https://example.com/app.tar.gzBuilt for builders.