How Many Times Does wget Retry a Failed Connection?

This article provides a quick overview of the default retry behavior of the wget command-line utility when a network connection fails. It covers the specific default retry limit, explains how wget handles different types of network errors, and demonstrates how you can customize this behavior using command-line flags to suit your specific downloading needs.

The Default Retry Limit

When you initiate a download using wget and the connection encounters a failure, the utility is programmed to automatically attempt to re-establish the connection and resume the download. By default, wget will attempt to retry the connection 20 times before it finally gives up and reports a failure.

This high default number ensures that transient network hiccups, temporary server overloads, or brief connectivity drops do not completely ruin a long-running or automated download script.

How wget Handles Retries

wget distinguishes between different types of errors before deciding whether to use one of its 20 default retries:

How to Change the Default Number of Retries

While 20 retries is the standard setting, you can easily modify this behavior using the -t or --tries option in your terminal command.