Date of last revision: 12/11/1998
A shell is what you use to interface with the Unix operating system with the keyboard. Unless you have changed your shell, you should be using the Bourne-Again Shell (older accounts may still be set up with Posix Shell).
When a shell is invoked as a 'login' shell (e.g. when you login or when you first open a terminal window in windows), it will execute certain 'initialization' files in your account (typically called 'dot' files). An 'interactive' or 'subshell' may be created from with several unix programs. These are not *login* shells because they were not created at the time you logged on or first opened the terminal window.
When your account was created, we give very basic initialization files: .cshrc, .login, and .profile. These files will work with any shell currently on the system. Some shells can use other initialization files as well as the supplied ones. See below and the man pages for details.
When a shell is 'terminated' (e.g. you press CTRL-D or type exit), something can be done on logout. This varies from shell to shell.
The shells (with their initialization files) are:
Bourne Shell
- Command: /bin/sh
- Description: The standard UNIX system command interpreter and command-level language. Most system level scripts are written in Bourne Shell.
- Available on: irix, osf (Replaced by Posix Shell on hpux)
- Login shells: .profile
- Upon exit: any command specified using the command
trap "command" 0
(Place in your .profile file)
Posix Shell
- Command: /usr/bin/sh
- Description: Intended to be a fully POSIX compliant shell. (IEEE Working Group 1003.2) It has functionality similar to ksh and is Bourne Shell compatible
- Available on: hpux, osf (as /bin/posix/sh). Bourne shell is used when the Posix shell is not available.
- Always executed: Contents of $ENV environment variable
- Login shells: .profile
- Upon exit: any command specified using the command
trap "command" 0
(Place in your .profile file)
- Other files: .sh_history (to keep track of command history)
Korn Shell
- Command: /usr/bin/ksh
- Description: Enhanced version of sh which incorporates history, command line editing, aliasing, and etc. It is not completely compatable with sh.
- Available on: All machines
- Always executed: Contents of $ENV environment variable
- Login shells: .profile
- Upon exit: any command specified using the command
trap "command" 0
(Place in your .profile file)
- Other files: .sh_history (to keep track of command history)
Description: Incorporates some of the best features of tcsh and ksh into a sh-compatible shell. Intended to be a conformant implementation of the POSIX Shell and Tools specification (IEEE Working Group 1003.2).
Bourne-Again Shell
Bash has its own helpme file.
Z Shell
Description: Incorporates some of the best features of csh and ksh into a sh-compatible shell.
Zsh has its own helpme file.
C Shell
- Command: /usr/bin/csh
- Description: A standard shell that has history, C-like syntax, aliases, and other nice features.
- Available on: All machines
- Always executed: .cshrc
- Login shells: .login
- Upon exit: .logout
Turbo C Shell
Description: An enhanced version of csh that incorporates command line editing, filename completion, and other advanced features. Intended to be fully compatible with csh, but a small number of packages/commands/etc may not work properly with tcsh.
Tcsh has its own helpme file.
CHANGING YOUR DEFAULT SHELL
On an HP Unix workstation, type:
ypchsh <login> [shell]
where <login> is your login name, and shell is one of:
/usr/bin/sh
/usr/bin/csh
/usr/bin/ksh
/usr/local/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/zsh
Note: The chsh command does not work! Do not use it!
You can also just type the name of the shell to run the shell without setting it as your default. This is the best way to compare the various shells.
If you do not know which shell you would like to use, the Design Center recommends the Bourne-Again Shell.
Other Topics of Interest