pavement

Shell

From FreeBSDwiki
Revision as of 15:44, 6 June 2006 by Ninereasons (Talk | contribs)
Jump to: navigation, search

Command interpretors (shells) allow programs and users to interface with the "kernel" (lower level of the operating system). Microsoft Windows users will compare the Unix shell to DOS.

Unix shells are traditionally CLIs (Command Line Interface) where users can type system commands to run programs and/or manipulate files and directories, within the bounds of your user context. A CLI shell provides a set of built-in commands and utilities which you can use to automate your commands on the command line, or by using shell scripts (files that contain a set of commands, which can be executed from the command line or by other scripts or programs - Windows users will compare these to batch files).

A shell can also be a GUI (Graphical User Interface). Examples of GUI shells are the X Windows System of Unix, the Window OS of Microsoft, and the Mac OS. CLI interfaces are available in Unix-like GUI environments through terminal emulator programs like xterm or rxvt. In Windows, a CLI is provided by command.com or cmd.exe. A DOS or Windows CLI prompt usually ends with >.

Shell families

The first generation shell was called sh, developed for Unix 1 by Ken Thompson at Bell Labs, in 1971. In the second generation, the Unix shell was re-written in two different directions: the Bourne shell (sh) and the C shell (csh). The Bourne shell initially focused on standardizing a builtin command set. The C shell focused on user-friendly improvements such as file name completion and command line editing. FreeBSD uses a Bourne shell (sh) for its default system command interpreter, and a C shell (tcsh) for the default login shell.

Steve Bourne developed sh for Unix 7, at Bell Labs in 1978. Third generation improvements of the Bourne shell include the Korn shell (ksh by Dave Korn, early 1980s), and the Bourne again shell (bash by Brian Fox in 1987 - a very popular, very user-friendly third generation shell, familiar to users of Linux, Apple Mac OS X (in the Terminal utility), and Cygwin). Bourne shell derivatives have a default CLI prompt that ends with $. The version of sh used by FreeBSD as the default command interpreter is similar to (but not the same as) the Korn shell.

Bill Joy (the creator of BSD) developed csh for BSD in 1979. Ken Greer also made improvements to the C Shell in the 1970s, called the TENEX C shell (tcsh). Versions of the C shell usually have a default CLI prompt that ends with %. The csh used by FreeBSD is actually tcsh, which is the default login shell.

Alternative shells

Besides the default shells (sh and tcsh), and the ports mentioned above (ksh and bash), there are a number of other powerful CLI shells available from the ports collection. Below are just a few shells that could serve as your primary login shell.

  • psh — combines aspects of bash and other shells with perl extensions, so that a variety of perl commands can be executed directly from the command line or in scripts.
  • scsh — provides Scheme language extensions, so that a variety of scheme code can be executed directly from the command line or in scripts.
  • zsh — a shell that combines many features of both, the C shell and Bourne shell, and adds powerful scripting language features of its own.

To change your login shell from one to another, install the alternative shell from the Ports tree and run the chsh command.

Personal tools