# Download a file with curl: -o, -O, redirects and resume

Source: https://checkcraft.ru/en/guides/curl-download-file.html · updated 2026-12-02

How to download a file with curl: save under your name with -o or the URL name with -O, follow redirects with -L, resume a broken download with -C -…

Practical workflow

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. [Download, no sign-up →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

Without flags curl prints the download to the console, so files need -o or -O. You almost always need -L too: download links often redirect. Below are commands for a normal download, resume, and checking you got the file and not an HTML error page.

Checkcraft · 24 November 2026

Get help with your first test →

## -o or -O

-o name saves under the given name. -O takes the name from the last part of the URL. If the URL ends in download or has parameters the name will be odd: use -o, or -J with -O to take the name from Content-Disposition.

## Do not save an error page

If the link expired, the server returns 404 or 403 with an HTML page and curl saves it under the archive name. -f makes curl fail on HTTP 400 and above and not write the error body to the file.

Repeating checks like this by hand? Checkcraft saves them and reruns them in one click. [Download Free →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

## Resume and retries

Resume a broken large download with -C - and the same -o: curl checks the size already saved. On an unstable network add --retry with a count, and in scripts --max-time so the download never hangs forever.

## Download commands

```
# сохранить под своим именем, пройти редиректы, не сохранять страницу ошибки
curl -fL -o report.zip https://files.example.com/download?id=42

# имя из адреса
curl -O https://files.example.com/builds/app-1.4.2.tar.gz

# имя из заголовка Content-Disposition
curl -OJ -L https://files.example.com/download?id=42

# докачать оборванную загрузку
curl -C - -o big.iso https://mirror.example.com/big.iso

# повторы и ограничение времени для скрипта
curl -fL --retry 5 --retry-delay 3 --max-time 600 -o big.iso https://mirror.example.com/big.iso
```

## Check you got the right file

- The size looks right, not a few kilobytes.
- The file command reports an archive or binary, not an HTML document.
- The checksum matches the published one: sha256sum on Linux, certutil -hashfile on Windows.

If a download breaks with an error number, see [curl errors](https://checkcraft.ru/en/guides/curl-errors.html).

## More on curl

Section overview and all guides: [curl command cheat sheet: flags and examples for APIs](https://checkcraft.ru/en/guides/curl-cheat-sheet.html).

- [curl through a proxy: -x, environment variables, SOCKS and no_proxy](https://checkcraft.ru/en/guides/curl-proxy.html)
- [PHP cURL: GET and POST requests with JSON, headers and error handling](https://checkcraft.ru/en/guides/php-curl.html)
- [Webhook: what it is, how it works and how to test it](https://checkcraft.ru/en/guides/webhook-testing.html)
- [curl GET request: parameters, response headers and status code](https://checkcraft.ru/en/guides/curl-get-request.html)
- [cURL examples: GET and POST requests with JSON on Linux, Windows and PowerShell](https://checkcraft.ru/en/guides/curl-post-json.html)

Next step

## Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

[Download Free](https://checkcraft.ru/en/download-checkcraft.html#free-download) · [Download and first run](https://checkcraft.ru/en/download-checkcraft.html)

No sign-up or email needed, the archive is ready in a couple of minutes. See the [edition limits](https://checkcraft.ru/en/pricing.html).

## References

[curl man page](https://curl.se/docs/manpage.html)

## Continue with a related task

[curl GET request: parameters, response headers and status code](https://checkcraft.ru/en/guides/curl-get-request.html) · [curl errors: codes 6, 7, 22, 28, 35, 60 and how to fix them](https://checkcraft.ru/en/guides/curl-errors.html) · [curl on Windows and PowerShell: how to run it and why commands fail](https://checkcraft.ru/en/guides/curl-windows-powershell.html) · [curl through a proxy: -x, environment variables, SOCKS and no_proxy](https://checkcraft.ru/en/guides/curl-proxy.html)

Start with the linked example and compare its result with your own test requirement.

Ask a person

## Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

[Ask in Telegram](https://t.me/checkcraftchat)Send an email

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

Page card: /ai/pages/en/guides/curl-download-file.md
