I'd like to know an equivalent to wget enabling me to set the proxy while calling the command (like
Any ideas ?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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:email@example.com:port/ https_proxy = http://username:firstname.lastname@example.org:port/ ftp_proxy = http://username:email@example.com: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.
-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
You need to edit the
wgetrc file located at
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.
Option that is not mentioned, but should be mentioned: Use environmental variables (depending your distro):
http_proxy=http://<proxy-server-ip>:<port> export http_proxy
You can include a username and password, if you have special characters in your password be sure to include the '-s.
export http_proxy=http://172.16.1.100:8080 export https_proxy='http://johndoe:ABCfirstname.lastname@example.org:8080'
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/'