LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-31-2004, 06:01 PM   #1
lsmith
Member
 
Registered: Feb 2004
Posts: 40

Rep: Reputation: 15
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....
 
Old 03-31-2004, 07:02 PM   #2
Huddlebum
Member
 
Registered: Nov 2003
Distribution: RedHat 9.0
Posts: 45

Rep: Reputation: 15
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.
 
Old 03-31-2004, 07:29 PM   #3
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
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.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chainging the PATH on login shells cliff76 Debian 5 06-16-2005 03:52 PM
help on the different shells... JoannesX Programming 2 02-06-2005 11:07 AM
Bash and login shells Adrohak Linux - Software 3 11-18-2004 10:21 AM
Why so many shells? linuxzouk Linux - Newbie 5 06-10-2004 07:36 AM
Shells andrewtc Linux - Newbie 3 05-01-2003 03:52 PM


All times are GMT -5. The time now is 04:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration