/etc/profile vs ~/.profile

Solution 1:

It all depends on with which user you're trying to log in. The global /etc/profile file is loaded for every user, while the ~/.profile is only loaded for the user.

~ points to the current user's home directory. So, if you would put it in /home/user-a/.profile and login as user-a, both global and its user-specific file are loaded (in that order), whereas if you would login as user-b without a .profile file, it only loads the global one.

Solution 2:

You may define a variable in every file:

ORDER=${ORDER}+"/etc/profile"

respectively

ORDER=${ORDER}+"~/.profile"

and perform an

echo ${ORDER}

to see, what was involved and in which order. Of course it will not tell you, if there were different scripts you missed.

So if you see one source mentioned, read that script to look, whether one script sources another one, and include these too.

/etc/bash.bashrc and ~/.bashrc and ~/.bash_login come to mind, as well as things from /etc/default.