curl File Download

Download files with curl using -o and -O flags. Resume interrupted downloads, limit bandwidth, show progress bars, and verify integrity of file transfers.

General

Detailed Explanation

Downloading Files with curl

curl is frequently used to download files from the web. It supports resumable downloads, bandwidth limiting, progress display, and authentication for protected resources.

Basic Download

Save with a custom filename using -o:

curl -o myfile.zip https://example.com/releases/v1.0.zip

Save with the remote filename using -O:

curl -O https://example.com/releases/v1.0.zip

Download Multiple Files

curl -O https://example.com/file1.zip -O https://example.com/file2.zip

Or use brace expansion:

curl -O "https://example.com/files/data-{01,02,03,04,05}.csv"

Resume Interrupted Downloads

Use -C - to automatically resume where a previous download left off:

curl -C - -O https://example.com/large-file.iso

The -C - flag tells curl to figure out the correct resume offset automatically.

Bandwidth Limiting

Limit download speed with --limit-rate:

curl --limit-rate 1M -O https://example.com/large-file.iso

Supports suffixes: K (kilobytes), M (megabytes), G (gigabytes) per second.

Progress Bar

Replace the default statistics with a simple progress bar:

curl -# -O https://example.com/file.zip

Or suppress all output for scripting:

curl -s -O https://example.com/file.zip

Conditional Download

Download only if the remote file is newer than the local copy:

curl -z localfile.zip -O https://example.com/file.zip

Verify Download Integrity

Combine curl with checksum verification:

curl -sO https://example.com/file.tar.gz
curl -s https://example.com/file.tar.gz.sha256 | sha256sum -c -

Follow Redirects for Downloads

Many download URLs redirect (e.g., GitHub releases). Always use -L:

curl -LO https://github.com/user/repo/releases/latest/download/app.tar.gz

Best Practice for Scripts

curl -fsSL --retry 3 --connect-timeout 10 -o app.tar.gz \
  https://example.com/app.tar.gz

This combination silently downloads with retries, fails on HTTP errors, and follows redirects.

Use Case

A system administrator writing a deployment script needs to reliably download release artifacts from a server with support for resuming interrupted transfers.

Try It — Curl to Code Converter

Open full tool