I am using Ubuntu Desktop 14.04, and as such, I am using the non-login shell. When I open the GUI terminal, first the non-login shell sessions read the following startup files:


The non-login shells inherit the environment from the parent process, which is a login shell, so the session also reads the following startup files:


However, I cannot find the $PATH for system-wide paths like /bin, /sbin, /usr/bin, /usr/sbin, set in any of these files. Where is the $PATH set for these directories?


The (default) system wide PATH is set in the /etc/environment file.

$ cat /etc/environment 

It is basically the place to save the global environment variables.

  • +1, however do you happen to know if $PATH it's inherited by the parent login shell or if it's reloaded by each bash instance? – kos Jun 10 '15 at 4:43
  • @kos All child processes inherit the environment from parent shell unless of course being run in a modified environment.. – heemayl Jun 10 '15 at 10:02
  • I notice that the shell does not seem to expand the $HOME variable. For instance, adding $HOME/.composer/vendor/bin to the PATH in /etc/environment does not enable binaries in this directory to be executed without a path prefix. Using ~/.composer/vendor/bin does not work either. I'm finding it necessary to add the absolute path, e.g.: /home/vagrant/.composer/vendor/bin. This seems related (though doesn't explain this behavior): askubuntu.com/questions/402353/… – Ben Johnson Jan 26 '18 at 1:40
  • 2
    @BenJohnson That's simply because /etc/environment (and ~/.pam/environment) is read by pam_env PAM module, not shell or anything else that understands shell/environment variables; same goes for ~ expansion. So, you need to use absolute path there. – heemayl Jan 26 '18 at 14:31

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.