How to Resume a Partial Download with wget?

When downloading large files over a unstable internet connection, interruptions can be incredibly frustrating. Fortunately, the wget command-line utility provides a built-in feature that allows you to pick up right where a failed or paused download left off, saving you both time and bandwidth. This article provides a quick, practical guide on how to use the resume function in wget, covers the specific syntax required, and explains how to handle potential troubleshooting scenarios.

The Core Command: Using the -c Flag

The secret to resuming a partial download lies in the -c (or --continue) option. When you use this flag, wget checks the local directory for a partially downloaded file matching the filename in the URL. If it finds one, it inspects the file size and asks the server to send only the remaining portion of the file.

To resume a download, simply open your terminal, navigate to the directory where the partial file is located, and run the following command:

wget -c https://example.com/largefile.zip

Important Note: For this to work seamlessly, you must run the command from the exact same directory where the incomplete file (e.g., largefile.zip) is stored.

How wget Behaves Under the Hood

When you initiate the resume command, wget executes a specific sequence of checks to ensure data integrity:

Handling Server-Side Limitations

While wget is highly efficient, its ability to resume a download depends heavily on the hosting server.

Automating Resets on Dropped Connections

If you are dealing with a highly erratic connection and do not want to manually type the resume command every time the download drops, you can combine the continue flag with retry options:

wget -c --tries=infinite --retry-connrefused https://example.com/largefile.zip

This combination tells wget to automatically retry an infinite number of times if the connection is refused or dropped, always utilizing the -c flag to ensure it never restarts the download from scratch.