Selecting a Login Shell

A login shell (or command shell) processes the command lines that are entered by the user. Linux provides a selection of several different login shells. Several shells are included in the distribution, and many more are available from the Internet. Despite the variety of shells, most sites standardize on one or two; every user account added to the sample passwd file in Listing 3.8 uses /bin/bash as the login shell.

The /etc/shells file is a list of valid shell names that is consulted by a number of programs to determine what shells are available on the system. Listing 3.9 is the /etc/shells file on a Red Hat system.

Listing 3.9: Available Login Shells

$ cat /etc/shells








The /etc/shells file on our sample Red Hat system provides the following login shell selections:

/bin/sh This is the Bourne Shell, which is the original Unix shell. The Bourne Shell introduced many of the fundamental concepts of command shells, but as you can imagine given the great age of Unix, the original Bourne Shell is seriously out-of-date. Despite that, feel free to make this selection on a Red Hat system because there is no Bourne Shell stored at /bin/sh. Instead, it is a link to /bin/bash.

/bin/bash This is the Bourne-Again Shell, which is the most popular shell on Linux systems. bash is the Bourne Shell with all of the modern enhancements such as command-line editing, command history, and filename completion that were introduced by newer shell programs.

/bin/bash2 This is yet another version of the Bourne-Again Shell, which provides all of the features of bash. On the Red Hat system, bash2 is exactly the same as bash because /bin/ bash2 is just a logical link to /bin/bash.

/bin/ash This is the A Shell. ash is a very compact program—only about one-fifth the size of bash. ash has minimal features in keeping with its very small size.

/bin/bsh This is the B Shell, which is another minimal shell designed to provide basic features in a small-sized package. bsh is just a link to ash on a Red Hat system.

/bin/csh This is the C Shell. csh is an early Unix shell with a command and scripting environment inspired by the C programming language. Though the original csh is now out-of-date, csh introduced important concepts, such as command histories, which are still used today. On a Red Hat system, /bin/csh is a link to /bin/tcsh.

/bin/tcsh This is the Tenex C Shell, which is the enhanced csh. tcsh adds filename completion and command-line editing to the C shell.

This list of shells includes four shells that are just logical links, another one that is a minimal shell, and only two shells that are widely used as login shells: bash and tcsh. Other Linux distributions have other lists, and you can add the names of other shells to the /etc/shells file if you add other shells to your system. If you have users coming to a Linux environment from other Unix operating systems, they may demand the Korn Shell. Two versions of the Korn Shell are in widespread use:

/bin/ksh This is the Korn Shell, which is one of the most popular Unix shells, and is the one that first introduced command-line editing.

/bin/zsh The Z Shell closely resembles the Korn Shell, and it provides advanced features, such as command completion and built-in spell-checking.

The /etc/shells file provides default values for a number of programs. Keep in mind that the list is just a suggestion; you don't have to select a shell from the list. You can type the pathname of any shell installed on your system as the user's login shell. There was an example of this in Chapter 2, when we used pppd as a login shell to configure PPP server accounts.

Was this article helpful?

0 0

Post a comment