curl / wget Cheatsheet - Command-line File Download & HTTP Requests

For engineers who call APIs, download files, and debug HTTP purely from the shell. Though often paired, curl and wget have different roles: curl is an HTTP client that suits API calls with methods/headers/cookies, while wget leans toward file fetching with clean resume and recursive mirroring. By the end you can pick the right tool per task, resume large downloads with wget -c, trace API issues with curl -v/-w, and handle proxies and auth.

Web Services·34 commands·Last updated 2026-08-02
curlwgetDownloadhttpCLI

Basic Requests 6

curl https://api.test
curl: print response body to stdout
curl -O https://x/file.zip
curl: save with original name (-O uppercase)
curl -o out.html https://x
curl: save to given filename
wget https://x/file.zip
wget: download with original name by default
wget -O out.html https://x
wget: save to given filename
curl -I https://x
curl: fetch headers only (HEAD)

HTTP Method 5

curl -X POST https://x
curl: specify request method
curl -d 'a=1&b=2' https://x
curl: POST form data (x-www-form-urlencoded by default)
curl -d @body.json https://x
curl: read request body from file
curl -H 'Content-Type: application/json' -d '{"a":1}' https://x
curl: POST JSON
curl -T file.zip https://x/upload
curl: upload file (PUT)

Headers & Cookies 5

curl -H 'Authorization: Bearer TOKEN' https://x
curl: custom header
curl -b cookie.txt https://x
curl: send cookies (from file)
curl -c cookie.txt https://x
curl: store Set-Cookie to file
wget --header="Auth: TOKEN" https://x
wget: custom header
wget --save-cookies c.txt --keep-session-cookies https://x
wget: save session cookies

Download & Resume 5

curl -C - -O https://x/big.iso
curl: resume download
wget -c https://x/big.iso
wget: resume download (-c)
wget -r -np -l 2 https://x/dir/
wget: recursive download (depth-limited)
curl -L https://x
curl: follow redirects (-L)
wget --mirror -p --convert-links https://x
wget: mirror site and localize links

Auth & Proxy 4

curl -u user:pass https://x
curl: basic auth
curl -x http://proxy:8080 https://x
curl: via HTTP proxy
wget -e use_proxy=yes -e http_proxy=http://proxy:8080 https://x
wget: via proxy
curl -k https://x
curl: skip TLS cert check (insecure)

Debug 5

curl -v https://x
curl: verbose (request/response headers)
curl -s -o /dev/null -w "%{http_code}" https://x
curl: print HTTP status only
curl -w "@curl-format.txt" https://x
curl: print timings via format file
wget -S https://x
wget: print response headers
wget --debug https://x
wget: debug mode

curl vs wget 4

Upload files
curl strong (PUT/POST any body); wget weak
Mirror whole site
wget strong (--mirror); curl needs manual scripts
Default output
curl to stdout; wget to disk
Ease of use
wget 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

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Aug 2, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us