Most of us use cURL for GET requests.
Few less used but powerful options in cURL. A curly thread ๐งต
Download a file with a new name with -o
curl -o myfile.csv https://example.com/file.csv
Resume an interrupted download with -C -
curl -C - -O https://images.unsplash.com/photo-1641762256336-16cb15d5850a
Store website cookie in file with --cookie-jar
curl --cookie-jar cnncookies.txt https://www.cnn.com/index.html -O
Send website cookies with --cookie
curl --cookie cnncookies.txt https://www.cnn.com/index.html
Retry on failure with --retry
curl --retry 5 --retry-max-time 120 https://www.cnn.com/index.html
Use proxy for curl with or without authentication with -x and -U
curl -x proxy.yourdomain.com:8080 -U user:password -O https://yourdomain.com/yourfile.tar.gz
Modify Name Resolution with --resolve
curl --resolve www.example.com:80:localhost https://www.example.com
Retrieve particular byte range with -r
curl -r 0-20000 -o myfile.png https://images.unsplash.com/photo-1641762256336-16cb15d5850a
Want to know more. There's an actual gitbook you can refer -
Read https://everything.curl.dev
Any other powerful cURL usage which we should know ?
Top comments (0)