A great variety of shells is available for Unix, including Bourne-compatible shells (sh, bash, ksh, pdksh, ash, dash, etc.), C shell (csh, tcsh), Z shell (zsh), and the Friendly Interactive Shell (fish).
The default shell in many Linux distributions and in recent versions of Mac OS X is Bourne-Again Shell (bash).
All Unix shells are similar, but they have different features. If you are beginning, and you are not aware of the differences between shells, then you probably want to start with a Bourne-compatible, POSIX-compatible shell such as bash or ksh.
- sh is the original Bourne shell. On many non-Linux systems, this is an old shell without the POSIX features. Thus bash and ksh (or even csh and tcsh) are better choices than sh. On some systems though, sh is really the same as bash or ksh.
- bash is the GNU Bourne-again shell. It is mostly Bourne-compatible, mostly POSIX-compatible, and has other useful extensions. It is the default on most Linux systems. If it is not the default, it is probably installed on Linux, and can also be installed on non-Linux systems.
- ksh is one of the three:
- Public domain ksh (pdksh) is Bourne-compatible  and mostly POSIX-compatible.
- AT&T ksh was a commercial shell. It has all of the features of pdksh, plus the ksh93 version has several interesting extensions, different from bash. It is licensed under an opensource license since 2005; Mac OS X 10.4 includes it.
- mksh is the MirBSD enhanced version of the Public Domain Korn shell (pdksh)
- ash, the Almquist shell, is a POSIX compliant shell that is much smaller than bash. It is the default shell in mutliple BSD variants. Its variant Debian Almquist shell (dash) is the default shell in Debian and Ubuntu Linux distributions for execution of shell scripts as opposed to interactive use.
BSD introduced the C shell, which sometimes resembles slightly the C programming language. This shell is csh. The shell tcsh is csh with more features. These shells are NOT Bourne-compatible. Many of the features were later added to the Bourne-compatible shells (except old copies of sh). When these features work differently in C shell and Bourne-compatible shells, this guide will describe the Bourne-compatible shells.
If csh or tcsh is your default shell, you might benefit by using bash or ksh to get Bourne-compatibility and POSIX features. Some users still prefer the C shell.
There are alternative shells such as zsh, the Z shell. The Z shell boasts extra and unusual features that make it the preferred shell of many (for example, it has a builtin ftp client). Though the Z shell is almost Bourne-compatible, it differs in enough ways that its default behaviour is not Bourne-compatible, though zsh is capable of masquerading as a Bourne shell when so instructed. It can also emulate ksh.
Temporarily using a different shellEdit
If you do not like the shell that you are using, you might want to use a different shell such as ksh or bash. Shells are normal programs, and can be run easily. The SHELL environment variable will still contain the default shell. The exit command will return you to the first shell.
tcsh> printenv SHELL /bin/tcsh tcsh> bash bash$ printenv SHELL /bin/tcsh bash$ exit exit tcsh>
Permanently changing the default shellEdit
Find list of shells by looking at /etc/shells (which can be done by executing more /etc/shells). The command passwd -e, on some systems chsh, will prompt for a new shell. To change from bash to tcsh one can simply execute chsh which will query the user to enter the absolute path to a new shell:
$ chsh Password: Changing the login shell for baldur Enter the new value, or press ENTER for the default Login Shell [/bin/bash]: /bin/tcsh
or the user can specify the shell:
$ chsh -s /bin/tcsh Password:
The shell must be specified using its absolute path, which may be found using which tcsh.
- pdksh Version 5.2.9 http://www.cs.mun.ca/~michael/pdksh/NEWS "can compile as sh again (--enable-shell=sh)."
- Top 5 open source command shells for Linux, opensource.com
- Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh, hyperpolyglot.org
- Evolution of shells in Linux, ibm.com
- Why is Bash everywhere (in most if not all Linux distributions)?, superuser.com
- 1.8 There Are Many Shells in Unix Power Tools by Peek, O'Reilly & Loukides, docstore.mik.ua
- 2. Shell Command Language in The Open Group Base Specifications Issue 7, opengroup.org
- Unix shell
- Comparison of command shells