Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
This chapter is from the book

Understanding Shells and Options

Depending on the particular Unix system you're using, you may have several shells available to you. Table 3.1 describes a few of the more common ones. Each of these shells has slightly different capabilities and features. Keep in mind that the differences in shells do not affect what you can do in Unix; rather, they affect how easily and flexibly you can interact with the system.

Table 3.1. Common Unix Shells

SHELL NAME

FEATURES

sh

This shell, which is the original Unix shell (often called the Bourne shell), is fine for scripting but lacks a lot of the flexibility and power for interactive use. For example, it doesn't have features like command completion, email checking, history, or aliasing.

csh and tcsh

This family of shells adds great interactive uses but discards the popular scripting support that sh-related shells offer in favor of a C programming-like syntax. Because of the C syntax, this shell is often just called the C shell. Unless you're a C programmer, these are not likely to be your best choices.

ksh, bash, and zsh

These provide a good blend of scripting and interactive capabilities, but they stem from different sources (bash is most similar to sh, hence the Bourne Again SHell name).

You'll likely have bash, ksh, or tcsh (csh)as your shell, but you can change to one of many other shells fairly easily. As Code Listings 3.3 and 3.4 show, you can start by finding out which shells are available to you. Figure 3.1 shows some shells and how they relate to each other.

Figure 3.1

Figure 3.1 Shells fit neatly into a few "families" with the exception of a few stragglers. Each shell in a family shares many characteristics with the others in the same family.

To see which shells are available to you:

  • cat /etc/shells

    At the shell prompt, type cat /etc/shells to find out which shells are available to you. Code Listings 3.4 and 3.5 show the results of this command on two different systems.

Code Listing 3.3. A minimal listing of available shells on a Unix system, including the basics but not too much in the way of choices.

[ejr@hobbes]$ more /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
[ejr@hobbes]$

Code Listing 3.4. These shells are available through an ISP. Notice the additional, custom shells that this ISP uses, including shells that provide special features such as not allowing logins.

xmission> cat /etc/shells
/usr/local/bin/tcsh
/bin/csh
/usr/bin/csh
/bin/ksh
/usr/bin/ksh
/sbin/sh
/usr/bin/sh
/usr/local/bin/zsh
/usr/local/bin/bash
/usr/local/bin/nologin
/usr/local/bin/terminated
/usr/local/bin/xmmenu.email
/usr/local/bin/xmmenu.noshell
/usr/lib/uucp/uucico
xmission>
  • + Share This
  • 🔖 Save To Your Account