Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

UNIX: The Complete Reference, Second Edition by Kenneth H. Rosen et al.

You can start another shell after you log in by using the name of the shell as a command; for example, to start the Korn shell, you could type ksh at the command prompt. This type of shell is not a login shell, and you do not have to log in again to use it, but it is still an interactive shell, meaning that you interact with the shell by typing in commands (as opposed to using the shell to run a script, as discussed in Chapter 20). The instances of the shell that run in a terminal window when you are using a graphical interface are also interactive non-login shells. When you start a non-login shell, it does not read your .profile, .bash_profile, or .login file (or your .logout file), but it will still read the second shell configuration file (such as .bashrc). This means that you can test changes to your .bashrc by starting another instance of the shell, but if you are testing changes to your .profile or .login, you must log out and then back in to see the results.

I was going through above lines and i dont understand what it means by interactive shell. and is it true that .profile is not read if i am using terminal.

moreover, what it means when you say that bourne is not is an interactive shell while bash/csh is an interactive shell?

share|improve this question
add comment

1 Answer

up vote 13 down vote accepted

An interactive shell is simply any shell process that you use to type commands, and get back output from those commands. That is, a shell with which you interact.

So, your login shell is interactive, as are any other shells you start manually, as described in the excerpt you quoted in your question. By contrast, when you run a shell script, a non-interactive shell is started that runs the commands in the script, and then exits when the script finishes.

The Bourne shell can be used as an interactive shell, just like bash or tcsh. In fact, many systems, such as FreeBSD, use sh as the default user shell. Modern shells like bash, zsh, tcsh, etc have many features that Bourne shell doesn't have, that make them more comfortable and convenient for interactive use (command history, completion, etc).

Interactive non-login shells (that is, shells you start manually from another shell or by opening a terminal window) don't read your .login or .profile files. These are only read and executed by login shells (shells started by the login system process, or by your X display manager), so the commands and settings they contain are only applied once, at the beginning of your login session. So, when you start a terminal, the shell that it spawns for you does not read your login files (.login for c-style shells, .profile for bourne style shells), but it does read the .cshrc, .bashrc etc files.

share|improve this answer
thanks, all clear now :-) –  munish Jul 18 '12 at 14:38
It is possible to run a shell as a non-interactive login shell. –  jw013 Jul 18 '12 at 15:01
True, but potentially confusing! –  D_Bye Jul 18 '12 at 15:04
ksh is also a modern shell :-) See www2.research.att.com/sw/download and use the menu on the left-hand margin to navigate to AST->ksh->overview. A new release comes out several times a year from David Korn and Glen Fowler. Good luck to all. –  shellter Jul 19 '12 at 4:24
@shellter - yes, indeed. But it's not one I've ever used, and I had to stop enumerating shells somewhere! ;-) –  D_Bye Jul 19 '12 at 10:40
add comment

Your Answer


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.