Per-user Wget defaults are useful when the same transfer policy has to be applied consistently across interactive commands, cron jobs, and ad-hoc recovery work. Moving those defaults into one startup file reduces repeated typing and lowers the chance of forgetting an important flag during routine downloads.
Wget reads startup commands from configuration files before processing the current command line. The user startup file /$HOME/.wgetrc is the practical place for account-specific defaults, and command-line options still override those settings for one-off runs when a job needs different behavior.
Because every future wget command for that account inherits the file, the startup policy should stay conservative and readable. Keep credentials protected, prefer defaults that are safe for unattended jobs, and use temporary command-line overrides instead of leaving risky experiments behind in /$HOME/.wgetrc.
$ [ -f ~/.wgetrc ] && cp -a ~/.wgetrc ~/.wgetrc.bak-$(date +%Y%m%d%H%M%S)
A backup is the fastest rollback when scheduled jobs change behavior after a startup-file edit.
$ cat > ~/.wgetrc <<'EOF' # Default Wget behavior for this account. user_agent = WgetBatchDefaults/1.0 tries = 5 timeout = 30 wait = 1 random_wait = on continue = on EOF
Startup-file directives use wgetrc syntax such as user_agent = ... instead of the long CLI option form.
$ chmod 600 ~/.wgetrc $ ls -l ~/.wgetrc -rw------- 1 user user 112 Mar 27 06:54 /home/user/.wgetrc
World-readable startup files can expose proxy settings, usernames, or other execution details that should stay private.
$ wget --spider --debug https://httpbin.org/user-agent 2>&1 | sed -n '/request begin/,/request end/p' ---request begin--- HEAD /user-agent HTTP/1.1 Host: httpbin.org User-Agent: WgetBatchDefaults/1.0 Accept: */* Accept-Encoding: identity Connection: Keep-Alive ---request end---
A visible custom User-Agent in the request block confirms that /$HOME/.wgetrc is being read for that account.
$ wget --user-agent='Wget/1.25.0' --spider --debug https://httpbin.org/user-agent 2>&1 | sed -n '/request begin/,/request end/p' ---request begin--- HEAD /user-agent HTTP/1.1 Host: httpbin.org User-Agent: Wget/1.25.0 Accept: */* Accept-Encoding: identity Connection: Keep-Alive ---request end---
Command-line options take precedence, which makes one-off overrides safer than editing the startup file for a temporary test.
$ wget --no-config --spider --debug https://httpbin.org/user-agent 2>&1 | sed -n '/request begin/,/request end/p' ---request begin--- HEAD /user-agent HTTP/1.1 Host: httpbin.org User-Agent: Wget/1.25.0 Accept: */* Accept-Encoding: identity Connection: Keep-Alive ---request end---
Use --no-config to separate binary behavior from local startup-file customizations during incident review.