Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the difference between a “login” shell and a “non-login” shell?

LOGIN non-login Shell
0

When you start a new Terminal window, the shell that is started is a “login shell”. (It is called this because historically, this the shell that is started when a user logged in to a text-only Unix machine.) When you start a sub-shell (by typing a shell’s name at the command-prompt), you get a “non-login shell”. When you open a new ‘xterm’ window (under Apple’s X11), the shell that you get is a “non-login shell”. This is a key difference between Terminal and xterm and (as explained below) affects what startup files are read. Another difference between shells is “interactive” versus “non-interactive”. An “interactive” shell is the type that you interact with in a Terminal window. But when you run a shell script, a new shell is started for the purpose of that script, and that new shell is a “non-interactive” shell (since the user is not interacting with it via the command-prompt).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123