Whenever I open a terminal I have this variable set:
$ echo $http_proxyWhere is this variable being set? I've checked .bashrc, .bash_profile, /etc/bash.bashrc and /etc/environment and it's nowhere there?!
I've also looked at System Settings in the network section and the proxy is empty.
03 Answers
For bash run:
PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 7> /tmp/mylogthen use
grep "http_proxy=" /tmp/mylogto search for it.
You can also limit the search to /home and /etc for a better result:
$ grep "http_proxy=" /tmp/mylog | grep -e /home -e /etc
++/home/ravexina/.bashrc> http_proxy=which means it has been set in my ~/.bashrc.
According to essentially the duplicate of what you asked on Unix & Linux site, there are couple of ways to approach this problem:
- use
envcommand and observe the order in which variables were created, and use preceding and next variables to get rough idea of where the variable may have come from - wrap files which you try to investigate with
set -xcommand in the beginning and end of the file to see what each file does; potentially those files are sourcing other files, andset -xshould explicitly state where sourcing occurs - Consider going through some of the files you may have in your home folder via
find -type f -exec grep 'VARIABLE_NAME' {} \;or justgrep -rI 'VARIABLE'. This is time consuming , so might not be the best result, but hey - if there's no easy methods, one shouldn't put aside the hard ones. - Run
strace -v -s 10000 -e execve,open,read bashand observer what is being read and what is the precedingopen()call. This might be useful with2&>1 > output_trace.txtredirection to read later and maybegrep. Source You mentioned .bashrc, .bash_profile, /etc/bash.bashrc and /etc/environment. You also need to check:
/etc/profile/etc/profile.d/*~/.profile(only if you don't have a~/.bash_profile)~/.bash_login
According to Arch Wiki, some programs like
wgetuse this variable. Check if you might have.wgetrcor/etc/wgetrcfile. This might be set there, although where it gets sourced intobashis another mystery
gnome-terminal itself (that is, this behavior is hardcoded to the binary) sets some of these variables based on the GNOME-wide gsetting values.