Skip to main content
Post Merged (destination) from unix.stackexchange.com/questions/18583/…
Polished the title a bit
Link
Henrik
  • 433
  • 3
  • 11

Is it possible to find out which files are _setting_setting/adding to environment variables, and their order of precedence?

Source Link
Henrik
  • 433
  • 3
  • 11

Is it possible to find out which files are _setting_ environment variables, and their order of precedence?

Some of my environment variables ($PATH, $MANPATH and friends) are partially set up in different source files.

I find myself wishing for a command or method to quickly gather what part, in a specific environment variable, came from what file.

My $PATH, for instance, has obviously been set (added to) in .bashrc, /etc/paths, /etc/paths.d/X11 … and I'm still looking for that last mysterious file which superfluously created a duplicate path definition in my $PATH.

It takes a good while to manually pinpoint the files that contribute to environment variables. There must be a useful way to bypass this unnecessary labor of tracing all the setters … or am I the only one thinking along these lines?