Centralizing common wget options in a personal .wgetrc file keeps command lines short, reduces repetitive typing, and lowers the chance of mistakes during scripted or bulk downloads. A predictable set of defaults is especially useful for scheduled jobs, backup routines, and long-running data collection tasks that rely on non-interactive HTTP, HTTPS, or FTP transfers.
The wget client reads configuration from the global file /etc/wgetrc and then from the per-user file /$HOME/.wgetrc, applying settings in that order so user options override system defaults. Each directive typically mirrors a long command-line flag, using syntax such as option = value or option value to control headers, proxy settings, timeouts, bandwidth limits, retry behavior, and directory layouts.
Changes in /$HOME/.wgetrc affect every wget invocation for that user, including existing scripts that expect stock behavior, so conservative settings and clear comments matter. Aggressive directives like robots = off, extremely low wait delays, or disabled certificate checks via check_certificate = off can overload remote services, weaken TLS verification, or conflict with acceptable-use policies.
Steps to configure default options in ~/.wgetrc:
- Open a terminal on Linux with the user account that runs wget.
$ whoami user
Personal settings in /$HOME/.wgetrc apply only to the account that owns the file, leaving other users and system services unaffected.
- Create or overwrite the personal configuration file /$HOME/.wgetrc with default options and descriptive comments.
$ cat > ~/.wgetrc <<'EOF' # Default directory for downloaded files dir_prefix = /home/user/Downloads/wget # Descriptive User-Agent string for logs user_agent = Wget/1.21.4 (Linux; custom-defaults) # Connection limits and timeouts tries = 5 timeout = 30 # Polite crawling behavior robots = on wait = 1 random_wait = on # Prefer IPv4 if IPv6 paths are unreliable inet4_only = on # Limit bandwidth to avoid saturating links (example: 1 MiB/s) limit_rate = 1m # Example HTTPS proxy configuration (uncomment and adjust if required) #https_proxy = http://proxy.example.net:3128 EOF
Options in /$HOME/.wgetrc override matching directives in the global file /etc/wgetrc for the same user.
- Review the file for accuracy before relying on it in scripts or automation.
Persistent settings such as check_certificate = off or robots = off can disable TLS verification and ignore robots.txt, which may expose downloads to interception and violate remote usage policies.
- Run wget in debug spider mode against a harmless HTTPS URL to confirm that /$HOME/.wgetrc is parsed.
$ wget --debug --spider https://www.example.com/ Setting --spider (spider) to 1 DEBUG output created by Wget 1.21.4 on linux-gnu. Reading HSTS entries from /home/user/.wget-hsts URI encoding = 'ANSI_X3.4-1968' converted 'https://www.example.com/' (ANSI_X3.4-1968) -> 'https://www.example.com/' (UTF-8) Converted file name 'index.html' (UTF-8) -> 'index.html' (ANSI_X3.4-1968) Spider mode enabled. Check if remote file exists. --2026-01-10 05:33:44-- https://www.example.com/ Resolving www.example.com (www.example.com)... 203.0.113.50 Caching www.example.com => 203.0.113.50 Connecting to www.example.com (www.example.com)|203.0.113.50|:443... connected. Created socket 3. Releasing 0x0000aaab0a8dba60 (new refcount 1). Initiating SSL handshake. Handshake successful; connected socket 3 to SSL handle 0x0000aaab0a8e0fc0 certificate: subject: CN=files.example.net issuer: CN=SG Test CA X509 certificate successfully verified and matches host www.example.com ---request begin--- HEAD / HTTP/1.1 Host: www.example.com User-Agent: Wget/1.21.4 (Linux; custom-defaults) Accept: */* Accept-Encoding: identity Connection: Keep-Alive ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.0 200 OK Server: sg-http/1.0 Python/3.12.3 Date: Sat, 10 Jan 2026 05:33:44 GMT Content-type: text/html Content-Length: 277 Last-Modified: Sat, 10 Jan 2026 04:05:33 GMT ---response end--- 200 OK Registered socket 3 for persistent reuse. Length: 277 [text/html] Remote file exists and could contain further links, but recursion is disabled -- not retrieving.
If the request runs without errors, the personal configuration has been parsed; the next step verifies the active defaults.
- Verify that the configured defaults take effect by performing a test download and inspecting behavior or headers.
$ wget --server-response https://www.example.com/ -O /dev/null 2>&1 | grep -E '^[[:space:]]*HTTP/|Content-type' HTTP/1.0 200 OK Content-type: text/html
Typical confirmation signals include files appearing under the configured dir_prefix directory, the custom User-Agent string visible in logs or debugging output, and request timing consistent with wait and random_wait values without extra command-line flags.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
