How to resume a download with cURL

Interrupted downloads waste time and bandwidth when a large archive, disk image, or backup already exists partly on disk. Resuming the same file avoids starting again from byte zero after a dropped connection, cancelled terminal session, or short-lived network outage.

cURL resumes a download with -C - or --continue-at -. The dash tells cURL to read the current local file size and request only the remaining bytes from the server, appending them to the same output file instead of replacing it.

Resume is only safe when the partial local file still belongs to the same remote object and the server accepts byte-range requests. Current cURL documentation also marks --continue-at as incompatible with --range, --no-clobber, and --remove-on-error, so resume jobs need a direct single-file transfer.

Steps to resume a download with cURL:

  1. Change to the directory that already contains the partial file and confirm that the interrupted download is still present under the filename that will be resumed.
    $ cd ~/downloads/releases
    $ ls -lh ops-agent-2026.04.21-linux-amd64.tar.gz
    -rw-r--r--  1 user  staff   256K Apr 21 22:18 ops-agent-2026.04.21-linux-amd64.tar.gz

    If the original transfer used -o, resume must use the same local filename so cURL can calculate the correct byte offset.

  2. Check the remote headers and confirm that the server advertises byte-range support for the same file.
    $ curl --silent --show-error -I https://downloads.example.net/releases/ops-agent-2026.04.21-linux-amd64.tar.gz
    HTTP/2 200
    accept-ranges: bytes
    content-length: 2787584
    content-type: application/gzip
    ##### snipped #####

    The accept-ranges: bytes header means the server can continue the transfer from a known byte offset instead of restarting the whole file.

  3. Resume the transfer with -C - and the same output filename used for the partial copy.
    $ curl -C - -o ops-agent-2026.04.21-linux-amd64.tar.gz https://downloads.example.net/releases/ops-agent-2026.04.21-linux-amd64.tar.gz
    ** Resuming transfer from byte position 262144
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 2466k  100 2466k    0     0  3779k      0 --:--:-- --:--:-- --:--:-- 3776k

    The -C - form reads the current file size automatically, so there is no need to calculate the resume offset by hand.

    If cURL reports Bad download resume, or if the remote file changed since the partial copy was created, delete the partial file and restart from byte zero.

  4. Compare the completed local byte count with the content-length value from the header check before using the file.
    $ wc -c ops-agent-2026.04.21-linux-amd64.tar.gz
    2787584 ops-agent-2026.04.21-linux-amd64.tar.gz

    Matching byte counts confirm that the resumed file reached the full remote length published by the server.

    If the local size does not match the remote length, remove the file and download it again from the start instead of trusting a truncated or mixed result.