Powerful options in cURL

arpitsr

Arpit Kumar

Posted on January 11, 2022

Powerful options in cURL

Most of us use cURL for GET requests.

Few less used but powerful options in cURL. A curly thread ๐Ÿงต

  1. Verbose output with -v
    curl -v www.cnn.com
    verbose

  2. Follow redirects with -L
    curl -L www.cnn.com
    redirect

  3. Download a file with a new name with -o
    curl -o myfile.csv https://example.com/file.csv
    download

  4. Resume an interrupted download with -C -
    curl -C - -O https://images.unsplash.com/photo-1641762256336-16cb15d5850a
    resume-download

  5. Store website cookie in file with --cookie-jar
    curl --cookie-jar cnncookies.txt https://www.cnn.com/index.html -O
    cookie jar

  6. Send website cookies with --cookie
    curl --cookie cnncookies.txt https://www.cnn.com/index.html
    send cookie

  7. Retry on failure with --retry
    curl --retry 5 --retry-max-time 120 https://www.cnn.com/index.html
    retry

  8. 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
    proxy

  9. Modify Name Resolution with --resolve
    curl --resolve www.example.com:80:localhost https://www.example.com
    name resolution

  10. Retrieve particular byte range with -r
    curl -r 0-20000 -o myfile.png https://images.unsplash.com/photo-1641762256336-16cb15d5850a
    byte range

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 ?

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
arpitsr
Arpit Kumar

Posted on January 11, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Powerful options in cURL
webdev Powerful options in cURL

January 11, 2022

ยฉ TheLazy.dev

About