Here are some common uses of the curl command:
-
Download a File:
curl -o filename.ext http://example.com/file -
Download with Progress Bar:
curl -# -o filename.ext http://example.com/file -
Download Using Remote Filename:
curl -O http://example.com/file -
Resume Interrupted Downloads:
curl -C - -o filename.ext http://example.com/file -
Limit Download Speed:
curl --limit-rate 100K -o filename.ext http://example.com/file -
Send Data with POST Request:
curl -X POST -d "param1=value1¶m2=value2" http://example.com/submit -
Send JSON Data with POST Request:
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com/api -
Authenticate with Username and Password:
curl -u username:password http://example.com/protected -
Get HTTP Headers Only:
curl -I http://example.com -
Follow Redirects:
curl -L http://example.com
These examples illustrate the versatility of curl for various tasks related to data transfer and web interactions.
