Skip to main content

cURL Cheatsheet

This cheatsheet includes curl commands and other useful shortcuts & flags that can be used to perform day to day actions.

cURL GET/HEAD Requests

NameCommand
Curl head requestcurl -I https://www.google.com
Curl head request with verbosecurl -v -I https://www.google.com
Curl with explicit http methodcurl -X GET https://www.google.com
Curl without http proxycurl --noproxy 127.0.0.1 http://www.stackoverflow.com
Curl has no timeout by defaultcurl --connect-timeout 10 -I -k https://www.google.com
Curl get with extra headerscurl --verbose --header "Host: www.mytest.com:8182" www.google.com
Curl get response with headerscurl -k -v https://www.google.com

cURL POST Requests

NameCommand
Curl post requestcurl -d "name=username&password=123456"
Curl post send jsoncurl <URL> -H "content-type: application/json" -d "{ \"woof\": \"bark\"}"

cURL Advanced

NameCommand
Get my public ipcurl -L -s http://ipecho.net/plain, curl -L -s http://whatismijnip.nl
Curl with credentialcurl -u $username:$password http://repo.dennyzhang.com/README.txt
Curl uploadcurl -v -F key1=value1 -F upload=@localfilename
Install curl in alpine linuxapk add --update curl
Curl with http2curl -k -v --http2 https://www.google.com/
Curl ftp uploadcurl -T cryptopp552.zip -u test:test ftp://10.32.99.187/
Curl ftp downloadcurl -u test:test ftp://10.32.99.187/cryptopp552.zip -o cryptopp552.zip
Curl upload with credentialcurl -v -u admin:admin123 --upload-file package1.zip http://mysever:8081/dir/package1.zip

cURL Scripts

NameCommand
Install packages with curlcurl-install-package.sh
Check a website response timecurl-url-time.sh
Beautify json output for curl responsecurl-format-json.sh
Curl run remote scriptscurl-remote-scripts.sh

WGET

NameCommand
Download one urlwget -O /tmp/google.html https://google.com
Download multiple urlswget https://google.com https://bing.com
Download a list of urlswget -i url-list.txt, url-list.txt