curl https://api.example.com/users
curl-X POST -H'Content-Type: application/json'-d'{"name":"Ada"}' https://api.example.com/users
curl-o release.tar.gz-L https://github.com/proj/repo/archive/v2.1.tar.gz
Note -o saves to a file, -O uses the remote filename. -L follows redirects (essential for GitHub downloads). -s silences progress bar. -I fetches only headers. -k skips TLS verification (use only for debugging, never in production).
Note -c resumes a partially downloaded file. -r downloads recursively, -np prevents ascending to the parent directory, -l sets recursion depth. wget is simpler than curl for straightforward downloads and supports resuming by default.
Note The download attribute only works for same-origin URLs or blob/data URIs. Cross-origin files will open in the browser instead of downloading.
Frequently asked questions
How do you download file?
This task is covered in 2 stacks on this page: Bash & Linux, HTML & CSS. The "Transfer Data with URLs" snippet in Bash & Linux uses `curl [options] URL`.
Which command does the Bash & Linux example use?
The "Transfer Data with URLs" snippet uses `curl [options] URL`, from the Networking section of the Bash & Linux cheat sheet.
Which stacks cover "download file" on this page?
Bash & Linux, HTML & CSS. Together they hold 3 copy-ready snippets for this task.
Is there anything to watch out for?
Yes. For "Transfer Data with URLs": -o saves to a file, -O uses the remote filename. -L follows redirects (essential for GitHub downloads). -s silences progress bar. -I fetches only headers. -k skips TLS verification (use only for debugging, never in production).