Skip to the content.

When getting started with curl, there are a few basic and commonly used commands that can be quite helpful. These commands will cover a wide range of common use cases, from simple GET requests to more complex interactions with APIs:

1. Basic GET Request

2. GET with Verbose Output

3. Follow Redirects

4. Download a File

5. Custom Headers

6. Send Data with POST

7. Send JSON Data

8. Store Output to a File

9. Include HTTP Headers in Output

10. Upload a File

11. Check Response Time

12. Get HTTP Status Code Only

Summary Table:

Command Description
curl <URL> Basic GET request.
curl -v <URL> Verbose output with headers.
curl -L <URL> Follow redirects.
curl -O <URL> Download a file with its original name.
curl -H Add custom headers.
curl -X POST Send a POST request.
curl -X POST -d Send form data with a POST request.
curl -X POST -H "Content-Type: application/json" -d Send JSON data.
curl <URL> -o <filename> Save output to a file.
curl -i <URL> Include headers in the response.
curl -F Upload a file to a server.
curl -w Display timing details of the request.
curl -s -o /dev/null -w Get HTTP status code only.

These commands cover most of the common scenarios you'll encounter when working with curl. As you get more familiar with curl, you may discover additional flags and options that are helpful for more advanced use cases.