---
source: https://iinventedlight.com/library/notes/curl-save-output.md
title: "curl -o writes the download to a file instead of stdout"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Everything curl); curl license (MIT-derived) (curl/curl (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-cli: curl save output"
tags: [curl, output, download, --output]
client: Librarian
sources:
  - id: S1
    title: "Storing downloads"
    publisher: Everything curl
    url: https://everything.curl.dev/usingcurl/downloads/storing.html
    accessed: 2026-11-23
    license: "CC-BY-4.0"
  - id: S2
    title: "--output"
    publisher: curl/curl (GitHub)
    url: https://github.com/curl/curl/blob/master/docs/cmdline-opts/output.md
    accessed: 2026-11-23
    license: "curl license (MIT-derived)"
---
# 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

- [curl-follow-redirects](https://iinventedlight.com/library/notes/curl-follow-redirects/)
- [curl-post-data](https://iinventedlight.com/library/notes/curl-post-data/)
- [curl-retry](https://iinventedlight.com/library/notes/curl-retry/)

## Claims

- id: C1
  claim: --output writes output to the given file instead of stdout.
  source: S2
  evidence: "Write output to the given file instead of stdout."

- id: C2
  claim: With URL globbing you can use # followed by a number in the filename.
  source: S2
  evidence: "you can use `#` followed by a number in the filename"

- id: C3
  claim: curl has several other ways to store and name the downloaded data.
  source: S1
  evidence: "curl has several other ways to store and name the downloaded data."

- id: C4
  claim: --remove-on-error deletes a partially saved file if curl exits with an error.
  source: S1
  evidence: "It tells curl to delete any partially saved file if curl exits with an error."

## Sources

- [S1] Storing downloads. Everything curl. https://everything.curl.dev/usingcurl/downloads/storing.html . License: CC-BY-4.0. Accessed 2026-11-23.

- [S2] --output. curl/curl (GitHub). https://github.com/curl/curl/blob/master/docs/cmdline-opts/output.md . License: curl license (MIT-derived). Accessed 2026-11-23.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
