Possible Duplicate:
Difference between Login Shell and Non-Login Shell?

I have been looking at /etc/profile and /etc/bash.bashrc to see how they are run, and notice that some are executed by non-login shells, some work with interactive shells, etc.

What are the differences in this type of shells, i.e., interactive & non-interactive, login & non-login, etc.?

The question may be pretty basic, but it seems I need to ask what a shell is, first and foremost. What is a shell, what is its relevance, how do you use it, and why does it exist to start with?

Update: To make the intent of the question better understood, what I need to understand besides the definitions, are the use cases for one type of shell or the other. It is the use cases that help understanding, not just dictionary definitions.

  • 3
    Why vote to close it? I asked this question because lots of times we are so accustomed doing things and thinking in a certain way and we take the tools we use and why we use them for granted. I am asking what seems to be a basic retarded question because of that.
    – vfclists
    Commented Oct 11, 2012 at 19:47
  • 6
    It's also unfortunate that the respondents don't take the answer from "what is the exact pedantic definition" into the realm of "why would you choose one or the other?". Commented May 15, 2015 at 22:16
  • 2
    The clearest explanation of what a shell is and why it exists that I've ever encountered is an answer right here on U&L stack exchange. Hope it helps.
    – Wildcard
    Commented Feb 3, 2016 at 20:37
  • 4
    This offers imo a more intuitive non-technical explanation for login vs non-login shell.
    – vadasambar
    Commented Oct 2, 2017 at 5:38
  • 2
    This is helpful too.
    – rosshjb
    Commented Jun 8, 2020 at 15:30

2 Answers 2


A shell is the generic name for any program that gives you a text-interface to interact with the computer. You type a command and the output is shown on screen.

Many shells have scripting abilities: Put multiple commands in a script and the shell executes them as if they were typed from the keyboard. Most shells offer additional programming constructs that extend the scripting feature into a programming language.

On most Unix/Linux systems multiple shells are available: bash, csh, ksh, sh, tcsh, zsh just to name a few. They differ in the various options they give the user to manipulate the commands and in the complexity and capabilities of the scripting language.

Interactive: As the term implies: Interactive means that the commands are run with user-interaction from keyboard. E.g. the shell can prompt the user to enter input.

Non-interactive: the shell is probably run from an automated process so it can't assume it can request input or that someone will see the output. E.g., maybe it is best to write output to a log file.

Login: Means that the shell is run as part of the login of the user to the system. Typically used to do any configuration that a user needs/wants to establish his work environment.

Non-login: Any other shell run by the user after logging on, or which is run by any automated process which is not coupled to a logged in user.

  • 6
    So, when I'm in a Linux GUI (Mint 17.1 Cinnamon for example) and I launch a Terminal (gnome-terminal for example), am I launching an "interactive shell"? Is this ALSO a "login shell", or is a "login shell" only when my user profile logs in to the OS (like right after boot)? Commented May 22, 2015 at 18:53
  • 9
    @JonWadsworth Yes, it's interactive. But, it is NOT a login shell. Effectively your XWindows GUI environment (Cinnamon in your case) acts as a sort-of login-shell substitute. Purists will not call XWindows a shell, becasue it is graphical in stead of text-based, but let's be honest. It serves the same purpose: Gives you a launcher to start other programs, including Terminal to get a text-based shell again.
    – Tonny
    Commented May 22, 2015 at 19:06
  • 4
    So, I am running OSX and I am already logged in and working. Now I run the terminal app to do some work in command prompt. I am obviously in an interactive shell. But am I in a login shell, or is that considered a non-login shell? Commented Dec 2, 2015 at 20:11
  • 2
    Thank you for splitting them in readable chunks. Makes it more understandable than the ones I got from the Possible Duplicate link and some old documentations online.
    – JohnnyQ
    Commented Sep 21, 2016 at 7:08
  • 7
    @retrography, for OSX, it will be a login shell.
    – Wildcard
    Commented Jan 23, 2017 at 11:54

It might be strange to realize for some of people who never had a comp disconnected from Internet, that lots of answers regarding UNIX systems are already shipped with them. For e. g., man bash, "Invocation" section:

An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive, allowing a shell script or a startup file to test this state.

  • @vfclists, man getty? :) Then when it mentions loginman login. And so on. ;) P. S. Sometimes there would be a gap in those docs, then you can try searching inside /usr/share/doc or invoke GNU's info.
    – poige
    Commented Oct 11, 2012 at 20:15
  • 1
    @vfclists the login and getty processes handle the user/id password check. When that is successfull they look in /etc/passwd which shell is the default for the user. That shell is started as login shell. If you started a terminal session from a GUI environment the terminal program would do the same. (Except for the userid/password check as you are obviously already logged on.)
    – Tonny
    Commented Oct 11, 2012 at 21:57
  • 19
    That doesn't really answer the OP's question, this information is only comprehensible to someone familiar with the concepts – and it's also specific to bash. Commented Mar 27, 2017 at 10:53

Not the answer you're looking for? Browse other questions tagged .