Login shells vs non-login shells
What is the difference between a 'Login shell' and a 'Non-login shell'?
From what I can gather, login shells source the /etc/profile and the ~/.bash_profile files as well as the /etc/bashrc and ~/.bashrc files. Non-login shells only source the latter two...
So what is the difference, and why is one used over another?
If I am in runlevel 3 each of the virtual terminals is a login terminal... right?
If I start a terminal in X, is it a login shell or a non-login shell? Why?
I have Eterm, and you can choose whether to make it login or not. Why should I have it either way?
Thanks in advance....
Some people have things in their ~/.bash_profile that you wouldn't want running in an Xterm. For example, I have made a .bash_profile that automatically started X when the user logged in.
Basically, the .bash_profile is used for things that only have to be done once per login, especially system administrative per-user tasks.
However, I'm not sure what the non-login and login distinction was originally for, and I'd be interested to know.
Hstorically, all logins started with the invocation of a shell, and all further commands would be executed from that shell, and inherit its environment. If you use startx from a login shell, this is still the case.
Over the course of a session, many shells will be started, and there is no need to re-initialize the environment for each one.
Nowadays, many people bypass the shell and log in directly to X via a display manager (xdm, gdm, kdm, or similar). Chances are that your .bash_profile (or .profile) will not have been sourced during the initialization of X, so you may wnat to start bash as a login shell to set up your preferred environment.
|All times are GMT -5. The time now is 10:53 PM.|