Selecting an Appropriate Shell

For casual use, many shells work equally well. All shells allow you to run external programs. Even most basic commands, such as Is, are actually external programs. Shells differ in some details of their scripting languages, as well as in some interactive features. Some shells are very unusual and may be suitable for use by less-experienced users who nonetheless need to use Linux over text-mode connections.

Tip You normally specify a user's shell in the user's account configuration, as described shortly. You can change shells temporarily by typing the shell's name; after all, a shell is just a program and as such it can be launched from another shell.

Some of the many shells available in Linux include:

bash The Bourne Again Shell (bash) is the default shell for most installations and accounts. It's an open source extension to the original Bourne shell (sh), which is popular on many Unix-like platforms. Linux distributions make sh a link to bash, so that scripts intended for sh run on bash.

tcsh This shell is an enhanced variant of a "classic" Unix shell, the C Shell (csh). Both csh and tcsh use a scripting language that resembles the C programming language, although csh/tcsh scripts are by no means C programs.

pdksh The Public Domain Korn Shell (pdksh) is an implementation of the Korn shell. It's similar to the Bourne shell, but it borrows some features from the C shell, as well.

zsh The Z Shell (zsh) is modeled after the Korn shell, but it adds some

This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks extra features.

sash The Stand Alone Shell (sash) is a small shell that incorporates many programs, such as Is, that are normally external, into the main sash executable. The goal is to have a shell that functions even on a system that's otherwise badly corrupted.

Any of these shells will serve well as your primary Linux shell, although you might prefer to reserve sash for emergency systems. In the end, shell choice is a highly personal matter; one person may have a strong preference for one shell, but somebody else may prefer another. I recommend that you try several of them. Because covering all of these shells would be impractical, the rest of this chapter focuses on bash, which is the default shell for most Linux distributions.

Note Differences between shells are most noticeable in relatively advanced features, such as command completion and details of the scripting language. As such, you probably won't notice much difference if you just use a shell's basic features.

The default shell is part of the user's account configuration. This information is stored as the final entry in the account's /etc/passwd line, which looks like this:

sandro:x:523:100:Sandro B.:/home/sandro:/bin/bash

To change the default shell, you can edit this file directly or use the usermod command, as shown here:

# usermod -s /bin/tcsh sandro

Editing /etc/passwd and running usermod both require superuser privileges. Ordinary users can change their shells by using the chsh program:

If the shell is omitted, the program prompts for it. The program also asks for a password as a security measure, to ensure that a passerby can't change a user's shell if the user leaves a terminal unattended for a minute.

Team LIB

Team LIB

^ previous

0 0

Post a comment