Using CheatSheets To Apply Best Practices

Curl Cheatsheet

Curl Cheatsheet

1.1 Curl Basic

Name Command
Curl head request curl -I
Curl head request with verbose curl -v -I
Curl with explicit http method curl -X GET
Curl post request curl -d "name=username&password=123456" <URL>
Curl get request and headers curl -k -v
Curl has no timeout by default curl --connect-timeout 10 -I -k
Curl add header curl --verbose --header "Host:"
Curl without http proxy curl --noproxy
Curl with credential curl -u $username:$password
Curl upload curl -v -F key1=value1 -F upload=@localfilename <URL>
Curl post send json curl <URL> -H "content-type: application/json" -d "{ \"woof\": \"bark\"}"
Get my public ip curl -L -s, curl -L -s

1.2 Curl Advanced

Name Command
Install curl in alpine linux apk add --update curl
Curl upload with credential curl -v -u admin:admin123 --upload-file http://mysever:8081/dir/
Curl with http2 curl -k -v --http2
Curl ftp upload curl -T -u test:test
Curl ftp download curl -u test:test -o

1.3 Curl Script

Name Command
Install packages with curl
Check a website response time
Beautify json output for curl response
Curl run remote scripts

1.4 Wget

Name Command
Download one url wget -O /tmp/google.html
Download mutiple urls wget
Download a list of urls wget -i url-list.txt, url-list.txt

1.5 More Resources

License: Code is licencurl under MIT License.

Leave a Reply

Your email address will not be published. Required fields are marked *