I guess gnome-terminal might have modified PATH environ variable when invoking shell.Specifically, $HOME/.local/bin:$HOME/bin will always be appended to PATH.I did the following experiment to demonstrate this:Open a gnome-terminaltraverse through Edit -> Preference -> Profiles and Edit your current profile(which is Unamed for me)Under the Command tab, check Run a custom command instead of my shell andfill in the following input area with sh. In this way, bash should be called in sh-way and it's not a login shell.To further make sure the /etc/profile, $HOME/.bash_profile, $HOME/.bashrc doesn'tget sourced, we rename these files temporarily. (Actually, these files should NOT getsourced already, as we are invoking a non-login sh.)Now, open a new gnome-terminal window and run echo $PATH. Here is what I got:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/naitree/.local/bin:/home/naitree/binI don't understand why the last two path appeared in PATH.Based on this fact, I think the following possible explanations exists:the PATH is inherited from parent process, which in this case is the gnome-terminal-server.the PATH is modifed in some script that is sourced mysteriously by sh at some point.the PATH is modifed when gnome-terminal-server forks off the subprocess.Now I think I have ruled out the #1 and the #2 possibilties:cat /proc/$PPID/environ where $PPID is the PID of gnome-terminal-server shows thatits PATH variable is /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin, which does not contain what we are looking for.In the sh we have just opened, run export -n PATH and sh -x, I can see nothingget sourced during the init process of this new sh. And its PATH is clean:/usr/local/bin:/usr/binWhich leaves me the last possibility.Did I missed something? Is gnome-terminal the culprit for the mysteriously modified PATH?Update:I just tried sh -x as the custom command. Upon opening gonme-terminal, I didn't see anything get sourced. But, echo $PATH says that $HOME/.local/bin and $HOME/bin are there.Here are distro related info:Fedora 23 (4.4.8-300.fc23.x86_64)bash version 4.3.42(1)-release (x86_64-redhat-linux-gnu)Update2:I just tried:Add echo $PATH at the very beginning of ~/.bashrc.opening gnome-terminal with bash in the default non-login shell mode, with custom command bash -x.Based on debug ouput, I observed that the ~/.bashrc is the starting point of script sourcing. But the $HOME/.local/bin and $HOME/bin are already there in PATH even before that.
Does gnome-terminal modify PATH when invoking shell
shell;path;gnome terminal