I'd like to know an equivalent to wget enabling me to set the proxy while calling the command (like wget --proxy=$http_proxy).

Any ideas ?


The -e option allows you to provide commands as in wgetrc at the command line so you do not need to change a file ...

wget -e use_proxy=yes -e http_proxy=$proxy http://askubuntu.com
  • Brilliant. You've saved a lot of trouble, simple as this answer is.
    – Wildcard
    Apr 4 '17 at 22:47
  • How do I turn it off?
    – Trect
    Jul 26 '18 at 7:44

Without modifying your system files at /etc/wgetrc you could create a file at your home directory ~/.wgetrc. It will enable you to modify wget settings locally at user level. Now write the following at ~/.wgetrc to use wget behind a proxy server:

use_proxy = on
http_proxy =  http://username:password@proxy.server.address:port/
https_proxy =  http://username:password@proxy.server.address:port/
ftp_proxy =  http://username:password@proxy.server.address:port/

If you do not have proxy username and password just write the proxy-address and port everywhere like,

http_proxy =  http://proxy.server.address:port/

This should work. I am assuming you already have proxy settings for all other applications.


You need to edit the wgetrc file located at /etc/wgetrc.

Use your favourite text editor, ie: nano /etc/wgetrc to edit it

Look for the http_proxy tag and remove the # in front of it, add the proxy server after the = sign, ie:


Then search for the use_proxy tag and remove the # in front of it, save the file.

wget will be then using the specified proxy server.

If you can't change system configuration with your user you can copy the current configuration to a place you can edit it, ie: cp /etc/wgetrc ~ and use the --config=~/wgetrc option to force wget to use the configuration you altered instead of the global configuration.

  • I'm aware of this possibility, but I can't modify config files.
    – merours
    Sep 17 '13 at 14:49
  • Think this is the only option you have with wget. Sep 17 '13 at 16:31
  • That's why I'm looking for an equivalent of wget as I indicated in the title.
    – merours
    Sep 18 '13 at 6:58
  • I have edited the title to reflect that, it was clear on the first place what you were trying to do. Sep 18 '13 at 8:57
  • Check the last paragraph of the answer. Sep 18 '13 at 9:00

Option that is not mentioned, but should be mentioned: Use environmental variables (depending your distro):

export http_proxy

or simply

export http_proxy=http://<proxy-server-ip>:<port>

Same for:


You can include a username and password, if you have special characters in your password be sure to include the '-s.



export http_proxy=
export https_proxy='http://johndoe:ABC!123@'

From the command line only I've found success preceding the wget command with the http_proxy information without the need of using the environment variables. For example:

  • $ http_proxy=<proxy-server-ip>:<port> wget http://www.example.com/
  • $ https_proxy=<proxy-server-ip>:<port> wget https://www.example.com/

Not the answer you're looking for? Browse other questions tagged or ask your own question.