curl / wget Cheatsheet - Command-line File Download & HTTP Requests
Downloading files, calling APIs and debugging HTTP — curl and wget are the go-to CLI tools. Grouped by requests, download, auth and debugging, with a side-by-side comparison and copy-ready examples.
Back to Web ServicesBasic Requests 6
curl https://api.testcurl: print response body to stdout
curl -O https://x/file.zipcurl: save with original name (-O uppercase)
curl -o out.html https://xcurl: save to given filename
wget https://x/file.zipwget: download with original name by default
wget -O out.html https://xwget: save to given filename
curl -I https://xcurl: fetch headers only (HEAD)
HTTP Method 5
curl -X POST https://xcurl: specify request method
curl -d 'a=1&b=2' https://xcurl: POST form data (x-www-form-urlencoded by default)
curl -d @body.json https://xcurl: read request body from file
curl -H 'Content-Type: application/json' -d '{"a":1}' https://xcurl: POST JSON
curl -T file.zip https://x/uploadcurl: upload file (PUT)
Headers & Cookies 5
curl -H 'Authorization: Bearer TOKEN' https://xcurl: custom header
curl -b cookie.txt https://xcurl: send cookies (from file)
curl -c cookie.txt https://xcurl: store Set-Cookie to file
wget --header="Auth: TOKEN" https://xwget: custom header
wget --save-cookies c.txt --keep-session-cookies https://xwget: save session cookies
Download & Resume 5
curl -C - -O https://x/big.isocurl: resume download
wget -c https://x/big.isowget: resume download (-c)
wget -r -np -l 2 https://x/dir/wget: recursive download (depth-limited)
curl -L https://xcurl: follow redirects (-L)
wget --mirror -p --convert-links https://xwget: mirror site and localize links
Auth & Proxy 4
curl -u user:pass https://xcurl: basic auth
curl -x http://proxy:8080 https://xcurl: via HTTP proxy
wget -e use_proxy=yes -e http_proxy=http://proxy:8080 https://xwget: via proxy
curl -k https://xcurl: skip TLS cert check (insecure)
Debug 5
curl -v https://xcurl: verbose (request/response headers)
curl -s -o /dev/null -w "%{http_code}" https://xcurl: print HTTP status only
curl -w "@curl-format.txt" https://xcurl: print timings via format file
wget -S https://xwget: print response headers
wget --debug https://xwget: debug mode
curl vs wget 4
Upload filescurl strong (PUT/POST any body); wget weak
Mirror whole sitewget strong (--mirror); curl needs manual scripts
Default outputcurl to stdout; wget to disk
Ease of usewget ready for download; curl more flexible for APIs
💡 Tips
- For large files use resume: curl -C - -O or wget -c, so a dropped connection does not restart.
- curl does not follow redirects by default — add -L; wget follows by default.
- To grab just the status code for health checks: curl -s -o /dev/null -w "%{http_code}".
- When POSTing JSON you must send -H "Content-Type: application/json", or the server parses it as form data.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Aug 2, 2026, continuously proofread against official docs.
Found an error? Report it
Wrong command or description? Open an issue to help us fix it.
Found an error? Report it