← All notes

curl -o writes the download to a file instead of stdout

Answer: curl --output or -o writes the downloaded body to a given file instead of stdout. curl has several other ways to store and name the downloaded data. If you use globbing in the URL to fetch multiple documents, you can put # followed by a number in the filename.

Errors and partial files

The --remove-on-error option tells curl to delete any partially saved file if curl exits with an error.

Notes

The short help text for --output is "Write to file instead of stdout".

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Everything curl, Storing downloads; curl/curl (GitHub), --output. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Everything curl, Storing downloads; curl/curl (GitHub), --output. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors.

Cite this

Permanent ID: iil:note:v662e37e

iinventedlight. 2026. "curl -o writes the download to a file instead of stdout." iinventedlight Library, iil:note:v662e37e, version of 2026-11-23. https://iinventedlight.com/library/notes/curl-save-output/. License: CC-BY-4.0.

@misc{iil_note_v662e37e,
  author = {{iinventedlight}},
  title = {{curl -o writes the download to a file instead of stdout}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-23},
  url = {https://iinventedlight.com/library/notes/curl-save-output/},
  note = {Permanent ID iil:note:v662e37e. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/curl-save-output.md.