How to Configure wget Config File on Ubuntu
This guide explains how to configure wget to use a configuration file for default settings on Ubuntu. You will learn where to place the configuration file, how to structure it, and which common settings to modify. By setting up a wgetrc file, you can avoid typing repetitive command-line arguments every time you download files.
Locate the Configuration File
wget looks for configuration settings in two primary locations. The
global configuration file is located at /etc/wgetrc and
applies to all users on the system. The user-specific configuration file
is located at ~/.wgetrc in your home directory. Settings in
the user-specific file override global settings. For most personal use
cases, editing the user-specific file is recommended.
Create or Edit the File
To create or edit your user configuration file, open your terminal and use a text editor like nano. Run the following command:
nano ~/.wgetrc
If the file does not exist, this command will create it. If it already exists, it will open the current content for editing.
Add Default Settings
Inside the file, add settings using the format
directive = value. Each setting must be on a new line. Here
are common examples to streamline your downloads:
dir = ~/Downloads quiet = on
continue = on timeout = 30
The dir setting changes the default download directory.
The quiet mode reduces output clutter, while
continue allows resuming broken downloads automatically.
The timeout setting defines how long wget waits for a
response before failing.
Verify the Configuration
Save the file and exit the editor. To verify that wget is reading your new settings, run a test download without specifying flags. For example:
wget https://example.com/file.zip
If the file downloads to your specified directory without extra
output, the configuration is active. You can also check the active
settings by running wget --help or observing the behavior
during a download task.