This subchapter looks at the shells available for Linux and UNIX.
what is a shell?
UNIX (and therefore also Mac OS X and Linux) has more than 200 basic commands (also called tools or utilities) that are distributed with the standard operating system. This collection and the ease with which they work together is the major source of the power of UNIX. The vast majority of these standard tools are designed to be used from a command line (the shell).
A shell is primarily a command interpreter.
In a graphical user interface such as Macintosh or Windows, the user controls the computer and programs primarily through pointing and clicking, supplemented by some typing.
In a shell, all of the commands are typed. The shell figures out the meaning of what you typed and then has the computer do as instructed.
But the shell is much more than just a command interpreter. It is also a complete programming language.
Because the shell is a complete programming language, with sequences, decisions, loops, and functions, it can do things well beyond pointing and clicking. It can take control of your computer and react to changing circumstances.
Programming languages are used to make all of the computer programs and smart phone apps youve ever seen or used. Your imagination is the only limit on the power of the shell. Anything that can be done with a computer can be done with the shell.
choice of shells
Most versions of UNIX and Linux offer a choice of shells.
The term shell comes from a concept of UNIX being a series of layers of software that work together rather than one single monolithic operating system program. The command line shell was part of the outer shell of a series of programs that eventually reach down to the kernel or innermost portion of the operating system.
Most shells are related to either the Bourne Shell or the C Shell.
The default shell in Linux and MacOS X is normally BASH (Bourne Again SHell). This book assumes the use of BASH, but often mentions how things differ in other shells.
It is possible to change the shell you are currently using (especially useful if you need to run a line or script from an alternative shell).
The original shell, called the Thompson shell and abbreviated sh was written by Ken Thompson at AT&Ts Bell Labs, was very rudimentary. The Thompson shell was distributed with Versions 1 through 6 of UNIX, from 1971 to 1975.
Note that the same sh is also used for other shells, including the Bourne shell.
The PWB shell or Mashey shell, abbreviated sh, was a variation of the Thompson shell that had been augmented by John Mashey and others at Bell Labs. The Mashey shell was distributed with the Prorgammers Workbench UNIX in 1976.
Stephen Bourne created the Bourne shell, abbreviated sh, at AT&Ts Bell Labs in New Jersey as a scripting language.
The Bourne shell was released in 1977 as the default shell in the Version 7 Unix release distributed to colleges and universities. It gained popularity with the publication of The UNIX Programming Environment by Brian W. Kernighan and Rob Pike. The book was the first commercially published tutorial on shell programming.
The Bourne shell (or a shell that is compatible and will run Bourne shell scripts) is usually located at /bin/sh.
You will also see references to the Bourne shell as bsh.
The Bourne shell has a command language based on the ALGOL programming language, including process control, variables, regular expressions, flow control (decisions and loops), powerful input and output control, and functions.
Despite its power, the original Bourne shell was difficult to use and lacked file name completion, command history, aliases, and had difficulty running multiple background jobs.
The C shell, abbreviated csh, was created by Bill Joy, a graduate student at the University of California, Berkeley. With additional work by Michael Ubell, Eric Allman, Mike OBrien, and Jim Kulp, it was released in the 2BSD release of BSD Unix in 1978.
The C shell was based on the style of the C programming language.
The C shell was much easier to use than the Bourne shell, but was unable to perform anything other than the most simple scripts.
The C shell lacked functions, had weak input and output control, and had limited programming ability due to a poorly written command interpreter (Bill Joy explained that at the time he didnt know about many standard compiler techniques).
The power of the C shell for everyday interactive use was due to its introduction of command history, aliases, file name completion, and job control.
It became common to use the C shell for everyday interactive computing and to use the Bourne shell for script programming.
The improved C shell or TENEX C shell, abbreviated tcsh, was created by Ken Greer by Spetember 1975 and merged into the C shell in December 1983. Ken Greer based the shell on the TENEX operating system (hence, the t in tsch). Mike Ellis, Paul Placeway, and Christos Zoulas made major contributions to tcsh.
The Hamilton C Shell was written in 1988 by Nicole Hamilton of Hamilton Laboratories for the OS/2 operating system. In 1992, the Hamilton C Shell was released for Windows NY. The OS/2 version was discontinued in 2003. The Windows version, with adaptations for Windows peculiarities, is still in use.
The Korn shell, abbreviated ksh, was created by David Korn at AT&Ts Bell Labs and announced at USENIX on July 14, 1983. Mike Veach and Pat Sullivan were also early contributors.
After years of UNIX users having to learn two different shells, one for scripting and oen for interactive control, David Korn built the Korn shell by adding C shell features to the Bourne shell.
In addition to adding command history, history substitution, aliases, and file name completion from the C shell, the Korn shell also included arrays and built-in integer arithmetic.
The three major versions of the Korn shell are the official version ksh, the public domain version pdksh, and the desktop version dtksh
CDE shipped with the Desktop version of the Korn shell.
The POSIX shell is a variant of the Korn Shell. HP shipped the POSIX shell with HP-UX 11.0
bash, which stands for Bourne Again SHell, was created by Brian Fox for the Free Software Foundation and first released on June 7, 1989.
bash combined features from the Bourne shell, the C shell (both the original C shell and tcsh), and the Korn shell, while using the syntax of the original Bourne shell, allowing it to run almost all historical Bourne shell scripts. bash is now the primary shell in both Linux and Mac OS X.
tt>bash introduced name completion for variable names, usernames, host names, and commands (in addition to file names), spelling correction for pathnames in the cd command, arrays of unlimited size, and integer arithmetic in any base from 2 to 64.
The Z shell, abbreviated zsh, was written by Paul Flastad in 1990 when he was a student at Princton University.
The Z shell combines features of the Bourne Shell, the C shell, and bash.
The POSIX shell, abbrevaited sh, (POSIX = Portable System Interface) is based on the Korn shell and is the official IEEE P1003.2 shell. It is the /bin/sh shell on some systems.
The Almquist shell, abbreviated ash, was written by Keneth Almquist as a replacement for the Bourne shell written for BSD systems. The sh in FreeBSD and NetBSD were based on the Almquist shell.
The Debian Almquist shell, abbreviated dash, is a modern replacement for the Almquist shell in Debian and Ubuntu Linux. While the default shell in both Debian and Ubuntu Linux are bash, /bin/sh is a symlink to ash.
ash and dash are minimalist shells that interpret scripts and are not intended for interactive use. Their small size and fast execution time make them good for embedded systems. Because many scripts call for the use of /bin/sh, Debian and Ubuntu UNIX gain speed of execution for scripts, while still allowing bash as the primary interactive shell.
The Public domain Korn shell, abbreviated pdksh, is based on the Korn shell.
The MirBSD Korm shell, abbreviated mksh, is based on the OpenBSD version of the Korn shell and the pdksh and was released as part of MirOS BSD.
Busybox is a set of tiny utilities, including a version of ash, used in embedded systems.
rc, written by Tom Duff, was the default shell for AT&Ts Bell Labs Plan 9 and Version 10 UNIX. Plan 9 was an improved operating system based on UNIX, but was not a significant enough improvement to overtake its predecessor. rc is available on some modern versions of UNIX and UNIX-like operating systems.
es is an rc-compatible shell written in the mid-1990s for functional programming.
Perl shell, abbreviated psh, is a shell that combines bash and the Perl scripting language. it is available for UNIX-like and Windows operating systems.
Friendly interactive shell, abbreviated fish, was released in 2005.
pysh is a profile in the IPython project that combines a UNIX-style shell with a Python scripting language shell.
wish is a windowing shell for Tcl.Tk.
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
Work on this project is very slow because I am homeless. I am available for work if someone can provide an indoor place to work in Costa Mesa, California, electricity, internet connections, a flat raised working surface (such as a table or desk), a sitting device (such as a chair or stool), and a fully functional reasonably modern used computer. Im already homeless, so you dont need to pay me (and I understand how much business people hate the minimum wage law). Just give me a chance to work.
Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.
If you like the idea of this project, then please donate some money.
send donations to: Milo
PO Box 1361
Tustin, California 92781
At the time I am homeless. This greatly interferes with my ability to create this project, which can help nearly 20 million U.S. college students and more than 150 million students world-wide. I am looking for 30 rich people or corporations willing to donate $10 a month to my church so that the church can provide a place indoors for me to continue work. If you want to donate, please see help project. Thanks much.
Supporting the entire project:
If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)
UNIX used as a generic term unless specifically used as a trademark (such as in the phrase UNIX certified). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.
Names and logos of various OSs are trademarks of their respective owners.