Skip to main content
1 of 3
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k

Typically PATH is set to an initial value in a highly system-dependent way by the program that logs you in (pam_env is a common contributor), then /etc/profile and ~/.profile and files that they include go on to modify that value.

Remove any change to PATH in .bashrc, environment settings don't below there: see Difference between .bashrc and .bash_profile.

First try logging in in text mode (e.g. with ssh localhost), as the session startup is a lot simpler than in graphics mode.

Put set -x at the beginning of /etc/profile and ~/.profile. The shell will print a trace of what it does on its standard error stream; look for assignments to PATH in the trace.

There is no notion of precedence to environment variable assignments: whoever assigns last wins.

Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k