The Swiss Army knife of HTTP
curl talks HTTP, HTTPS, FTP, SCP, SFTP, and dozens of other protocols. Day-to-day, you use it for HTTP — fetch, follow redirects, set headers, send JSON. Master a small set of flags and curl handles 90% of API debugging from the terminal.
The flags worth memorizing
| Flag | Purpose |
|---|---|
-v | Verbose — show request and response headers |
-I | HEAD only — fetch headers, skip body |
-L | Follow 3xx redirects |
-o file | Write body to file |
-O | Save with the URL's filename |
-s | Silent (no progress bar) |
-S | Show errors even with -s |
-w '%{http_code}' | Print the status code (great for scripts) |
--max-time N | Hard timeout in seconds |