curl
Quick Reference
Command Name:
curl
Category:
networking
Platform:
Linux/Unix/Windows
Basic Usage:
Common Use Cases
- 1
Web data transfer
Transfer data to and from web servers
- 2
API testing
Test REST APIs and web services
- 3
File downloading
Download files from web servers and FTP sites
- 4
Web scraping
Extract data from web pages and services
Syntax
curl [options] [URL...]
Options
Option | Description |
---|---|
-A, --user-agent | Specify the User-Agent string to send to the server |
-b, --cookie | Send cookies from a string or file |
-c, --cookie-jar | Write cookies to a file after operation |
-C, --continue-at | Resume a download from a specific position |
-d, --data | Send data in a POST request |
-F, --form | Send a multipart/form-data request |
-H, --header | Add custom headers to the request |
-I, --head | Fetch headers only (HTTP HEAD request) |
-k, --insecure | Allow insecure connections (skip SSL certificate verification) |
-L, --location | Follow redirects |
-m, --max-time | Set a maximum time for the transfer |
-o, --output | Write output to a file instead of stdout |
-O, --remote-name | Save output to a file using the remote filename |
-s, --silent | Silent mode (don't show progress or errors) |
-S, --show-error | Show errors even in silent mode |
-u, --user | Specify username and password for authentication |
-v, --verbose | Make the operation more verbose (show detailed information) |
-X, --request | Specify the request method (GET, POST, PUT, DELETE, etc.) |
--limit-rate | Limit the transfer speed |
--proxy | Use the specified proxy |
--ssl-reqd | Require SSL/TLS for the connection |
Examples
How to Use These Examples
The examples below show common ways to use the curl
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
curl https://example.com
curl -o output.html https://example.com
curl -O https://example.com/file.zip
Advanced Examples:
curl -X POST -d "name=John&age=25" https://example.com/api