Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I run ubuntu 12.04.1 LTS. And I can't get what is the order/priority for loading profile files. When I start the system and login using GUI which file is loaded? And why? What if run login-shell? Will it be the same? Actually right now I can't get why my ~/.profile doesn't load when system starts because here I see it should:

https://help.ubuntu.com/community/EnvironmentVariables

share|improve this question
    
How are you testing whether ~/.profile is loaded? –  Andrea Corbellini Dec 19 '12 at 20:24
    
There is environment variable is updated in ~/.profile –  sunprophit Dec 19 '12 at 20:25
add comment

4 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Hm, $ORDER is empty, which means none of them are loaded? –  sunprophit Dec 20 '12 at 9:40
    
Not sure why $ORDER was empty, maybe because of some syntax error. I don't know a lot about dash and bash differences. Although I am going to mark you answer as the correct one because it helped to get where is the problem. –  sunprophit Dec 20 '12 at 10:49
add comment

It's my fault. There was [[ some_test ]] in my ~/.profile and it runs good in bash, but I guess dash runs some pre_session_creation/post_session_creation commands on session start and dash don't know [[ keyword. So everything had been loaded but stopped at the error.

share|improve this answer
add comment

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.

share|improve this answer
    
In current user's profile (~/.profile) there is part which should update environment variables. I mean it's not in some another profile. It's profile of this user. But I tried @user_unknown solution to test profiles loading and it seems none of them are loaded. –  sunprophit Dec 20 '12 at 9:49
add comment

Both should be loaded, and ~/.profile should be loaded last (meaning it has priority).

share|improve this answer
    
Then I am not sure what is going on. If I run it explicitly in terminal it loads. Could there be problem during login and in result ~/.profile doesn't load, but then in terminal there is no these problems. Could I check if system tried to load it? –  sunprophit Dec 19 '12 at 20:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.