I have a problem with wget and I've discover that my proxy settings is wrong:

$ env | grep "proxy"

So, when I try to download something with wget, it fails trying to connect to the proxy, and not trying to connect to the web resource that I need to download.

But in superuser mode all is correct:

$ sudo su
$ env | grep "proxy"

(empty output, no proxy)

I want to know where this variables are settings, and I found a lots of problems. I added the next line to the beginning of my /etc/profile:

env | grep "proxy"
echo "Hello"

And for me surprise, both variables are settings with that same values before any configuration file is loaded (/etc/bashrc, ~/.bashrc, etc):

(new terminal)

Moreover, I work with guake. So, I tried the same with a common terminal, and for me surprise, (I think) the file /etc/profile isn't loaded, since I don't see nor the proxy lines but neither the echo "Hello" message.

So, I would like to know how is possible that http_proxy and https_proxy are defined before loading /etc/profile and why I don't see the "Hello" message when I open a common terminal.


The message is not displayed when you open a "normal" terminal because /etc/profile is only read for login shells, a "normal" terminal starts an interactive, non-login shell. See my answer here for more information.

Now, I don't know where your http_proxy is set. Depending on what exactly your setup is, it could be in various places. Try this:

grep http_proxy /etc/bash.bashrc /etc/profile ~/.bashrc ~/.bash_login ~/.profile ~/bash_profile

The variable should be set in one of those files.


Some file that is run on shell startup is setting the environment variables, such as ~/.bashrc , ~/.bash_profile, or /etc/bash.bashrc

You don't have to change any file to take off the proxy variable, though! All you have to do is use the 'unset' command!

$ unset http_proxy
$ unset https_proxy

Now those environment variables are gone! If you can't track down where they are set, you can add that to the end of your ~/.bashrc, and unset them for every shell. If you test it out again:

$ env | grep proxy

You'll see they've gone!

  • But, the key of the question is that this variable is set before any configuration file is loaded. The question is where can a variable be setted before /etc/profile. Apr 15 '13 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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