Working with large file downloads over unstable internet connections can sometimes lead to interrupted downloads. This can be particularly frustrating, especially if the download has progressed significantly. It's often time-consuming and data-wasting to start the download process from the beginning.

cURL offers the feature to resume interrupted downloads. Instead of starting from scratch, cURL picks up where the download stopped, ensuring efficient bandwidth use and saving time. It is however dependent on the server's support for the HTTP Range header.

Some servers may not support the HTTP Range header. In such cases, cURL will start the download from the beginning.

You can use the feature when downloading a single large files or when downloading multiple files. If you're downloading multiple files, cURL will skip the files that have already been downloaded and resume the download for the files that were interrupted.

Steps to resume interrupted download using cURL:

  1. Open the terminal.
  2. Start your download using cURL.

    $ curl -O https://onlineweb.tools/largefile.zip
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0 10.0G    0 44.5M    0     0  4654k      0  0:37:32  0:00:09  0:37:23 7196k^C
  3. Use the -C – option with cURL to resume any interrupted download.

    $ curl -C - -O https://onlineweb.tools/largefile.zip
    ** Resuming transfer from byte position 52240384
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0  9.9G    0 42.9M    0     0  7101k      0  0:24:29  0:00:06  0:24:23 9899k

    cURL will check the local file for its size and will resume the download from where it was interrupted.

    This only works if the web server supports the HTTP Range header.

  4. Verify the file's integrity by comparing the file size or using checksums.

    $ ls -l largefile.zip
    -rw-r--r--@ 1 user  group  10737418240 Sep  9 21:05 largefile.zip
  5. If you encounter errors, you may need to reinitiate the download without the -C – flag to start from the beginning.

    $ curl -O https://www.example.com/largefile.zip
  6. Clean up any incomplete or corrupted files that might have been created due to multiple interrupted download attempts.

    $ rm largefile.zip.part

    Some systems or tools append .part or similar extensions to indicate partial downloads.