2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
cheat.sheets/sheets/curl

51 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-10-20 22:59:45 +00:00
# curl
# Command-line tool for transferring data with URL syntax
2020-11-12 10:04:04 +00:00
# Process a single GET request, and show its output on stdout.
2017-05-08 20:27:00 +00:00
curl http://path.to.the/file
2020-10-20 22:59:45 +00:00
# Download a file and specify a new filename.
2017-05-08 20:27:00 +00:00
curl http://example.com/file.zip -o new_file.zip
2020-10-20 22:59:45 +00:00
# Download multiple files.
2017-05-08 20:27:00 +00:00
curl -O URLOfFirstFile -O URLOfSecondFile
2020-10-20 22:59:45 +00:00
# Download all sequentially-numbered files (1-24).
2017-05-08 20:27:00 +00:00
curl http://example.com/pic[1-24].jpg
2020-10-20 22:59:45 +00:00
# Download a file and follow redirects.
curl -L http://example.com/file
2020-10-20 22:59:45 +00:00
# Download a file and pass HTTP Authentication.
curl -u username:password URL
2017-05-08 20:27:00 +00:00
2020-10-20 22:59:45 +00:00
# Download a file with a Proxy.
2017-05-08 20:27:00 +00:00
curl -x proxysever.server.com:PORT http://addressiwantto.access
2020-10-20 22:59:45 +00:00
# Download a file from FTP.
2017-05-08 20:27:00 +00:00
curl -u username:password -O ftp://example.com/pub/file.zip
2020-10-20 22:59:45 +00:00
# Get an FTP directory listing.
2017-05-08 20:27:00 +00:00
curl ftp://username:password@example.com
2020-10-20 22:59:45 +00:00
# Resume a previously failed download.
2017-05-08 20:27:00 +00:00
curl -C - -o partial_file.zip http://example.com/file.zip
2020-10-20 22:59:45 +00:00
# Fetch only the HTTP headers from a response.
2017-05-08 20:27:00 +00:00
curl -I http://example.com
2020-10-20 22:59:45 +00:00
# Fetch your external IP and network info as JSON.
2017-05-08 20:27:00 +00:00
curl http://ifconfig.me/all/json
2020-10-20 22:59:45 +00:00
# Limit the rate of a download.
2017-05-08 20:27:00 +00:00
curl --limit-rate 1000B -O http://path.to.the/file
2020-10-20 22:59:45 +00:00
# POST to a form.
2017-05-28 21:19:44 +00:00
curl -F "name=user" -F "password=test" http://example.com
2017-05-08 20:27:00 +00:00
2020-10-20 22:59:45 +00:00
# POST JSON Data.
2017-05-08 20:27:00 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}' http://example.com
2020-10-20 22:59:45 +00:00
# POST data from the standard in / share data on sprunge.us.
2017-05-08 20:27:00 +00:00
curl -F 'sprunge=<-' sprunge.us