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 alice
Personal settings in /$HOME/.wgetrc apply only to the account that owns the file, leaving other users and system services unaffected.
- Create or open the personal configuration file /$HOME/.wgetrc in a text editor.
$ nano ~/.wgetrc
Options in /$HOME/.wgetrc override matching directives in the global file /etc/wgetrc for the same user.
- Add default options and comments describing intended behavior to /$HOME/.wgetrc.
~/.wgetrc # Default directory for downloaded files dir_prefix = /home/alice/Downloads/wget # Descriptive User-Agent string for logs user_agent = Wget/1.21.2 (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.com:3128
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.
- Save the file in the editor after the options are in place.
Keeping short, focused comments above each block of directives makes future audits and troubleshooting significantly easier.
- Run wget in debug spider mode against a harmless HTTPS URL to confirm that /$HOME/.wgetrc is parsed.
$ wget --debug --spider https://example.com DEBUG output created by Wget 1.21.2 on linux-gnu. Reading HSTS entries from /home/alice/.wget-hsts Reading Wgetrc configuration file '/home/alice/.wgetrc' Spider mode enabled. Check if remote file exists. ##### snipped #####
The line that mentions Reading Wgetrc configuration file '.../.wgetrc' confirms that the personal configuration file is loaded.
- Verify that the configured defaults take effect by performing a test download and inspecting behavior or headers.
$ wget --server-response https://example.com -O /dev/null HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 ##### snipped #####
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.
Comment anonymously. Login not required.
