Skip to content
Latchkey

wget --timeout: Connect, Read and DNS Timeouts

wget --timeout sets connect, read, and DNS timeouts at once; the more specific flags override it.

Without timeouts a download can hang until the job-level limit kills it. Explicit timeouts let wget fail and retry quickly instead.

What it does

wget --timeout=<sec> sets the DNS, connect, and read timeouts together. --connect-timeout bounds the TCP connect, --read-timeout bounds how long wget waits for data on an idle connection, and --dns-timeout bounds name resolution. A more specific flag overrides the general --timeout.

Common usage

Terminal
wget --timeout=30 https://example.com/file.bin
# separate connect and read budgets
wget --connect-timeout=10 --read-timeout=60 \
  https://example.com/slow.bin
# pair with retries
wget --timeout=20 --tries=4 https://example.com/file.bin

Options

FlagWhat it does
--timeout=<sec>Set DNS, connect, and read timeouts together
--connect-timeout=<sec>Maximum time for the TCP connect
--read-timeout=<sec>Maximum idle time waiting for data
--dns-timeout=<sec>Maximum time for DNS resolution
-T <sec>Short form of --timeout

In CI

Set a --read-timeout so a stalled server connection does not hang the runner until the global job timeout. Combine timeouts with --tries: a short timeout plus a few retries recovers from a slow mirror without waiting indefinitely.

Common errors in CI

Connection timed out comes from connect or read timeouts firing; raise --connect-timeout if the host is just slow to accept. Read error (Connection timed out) in headers means the server stopped sending mid-transfer. A 0 read-timeout disables the read timeout entirely, which can mask a hung download.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →