Using CheatSheets To Apply Best Practices

Curl Cheatsheet

Curl Cheatsheet

1.1 Curl Get/Head

Name Command
Curl head request curl -I
Curl head request with verbose curl -v -I
Curl with explicit http method curl -X GET
Curl without http proxy curl --noproxy
Curl has no timeout by default curl --connect-timeout 10 -I -k
Curl get with extra headers curl --verbose --header "Host:"
Curl get response with headers curl -k -v

1.2 Curl POST

Name Command
Curl post request curl -d "name=username&password=123456" <URL>
Curl post send json curl <URL> -H "content-type: application/json" -d "{ \"woof\": \"bark\"}"

1.3 Curl Advanced

Name Command
Get my public ip curl -L -s, curl -L -s
Curl with credential curl -u $username:$password
Curl upload curl -v -F key1=value1 -F upload=@localfilename <URL>
Install curl in alpine linux apk add --update curl
Curl with http2 curl -k -v --http2
Curl ftp upload curl -T -u test:test
Curl ftp download curl -u test:test -o
Curl upload with credential curl -v -u admin:admin123 --upload-file http://mysever:8081/dir/

1.4 Curl Script

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

1.5 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.6 More Resources

License: Code is licencurl under MIT License.

Leave a Reply

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