← All bricks

curl · Beginner

curl: HTTP from the Command Line

Drive HTTP from your terminal with curl — read responses and headers, follow redirects, send forms and JSON, authenticate, upload files, handle cookies, and pipe the result straight into your tools.

curl is the universal HTTP client: it's on every server you SSH into, it speaks every method, and it shows you exactly what went over the wire. We start from a plain GET and build up real fluency one flag at a time — inspecting headers, following redirects, saving files, posting forms and JSON, setting custom headers, authenticating, uploading, juggling cookies, and shaping requests with query strings. By the end you can read a response down to its status code, fail loudly in a script, and pipe JSON straight into jq. Every step is one command and its exact output, so each flag lands on its own.

What you'll build

  • Make requests and read responses, headers, and status codes
  • Follow redirects and save responses to files
  • Send form data and JSON, and switch HTTP methods
  • Set custom headers and authenticate with basic auth and tokens
  • Upload files and manage cookies across requests
  • Fail loudly in scripts and pipe results into other tools

Contents

  1. Check your curl
  2. Your first request
  3. A server that talks back
  4. Show the response headers
  5. Headers only
  6. See the whole conversation
  7. Quiet the progress meter
  8. Follow redirects
  9. Save to a file you name
  10. Save under its remote name
  11. Post form data
  12. Encode values safely
  13. Send JSON the short way
  14. Set the content type by hand
  15. Choose the method
  16. Delete a resource
  17. Send a custom header
  18. Basic authentication
  19. Send a bearer token
  20. Upload a file
  21. Save the cookies you receive
  22. Send the cookies back
  23. Add a query string
  24. Build a query string safely
  25. Print just the status code
  26. Fail on error responses
  27. Fail, but keep the body
  28. Pin a hostname to an IP
  29. Retry transient failures
  30. Set the user agent
  31. Skip certificate checks — carefully
  32. Pipe JSON into jq
  33. Put it together
  34. Make it your own