All Topics  
Unix shell

 

   Email Print
   Bookmark   Link






 

Unix shell



 
 
A Unix shell is a command-line interpreter (see shell
Shell (computing)

In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
) and script host that provides a traditional user interface
User interface

The user interface is the aggregate of means by which people—the User s—Interaction with the system—a particular machine, device, computer program or other complex tools....
 for the Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 and for Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 systems. Users direct the operation of the computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
 by entering command input as text for a command line interpreter
Command line interpreter

A command-line interpreter is a computer program that reads lines of text entered by a user and interprets them in the context of a given operating system or programming language....
 to execute or by creating text scripts of one or more such commands.

The most generic sense of the term shell
Shell (computing)

In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
 means any program that users use to type commands.






Discussion
Ask a question about 'Unix shell'
Start a new discussion about 'Unix shell'
Answer questions from other users
Full Discussion Forum



Encyclopedia


Bash Screenshot
A Unix shell is a command-line interpreter (see shell
Shell (computing)

In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
) and script host that provides a traditional user interface
User interface

The user interface is the aggregate of means by which people—the User s—Interaction with the system—a particular machine, device, computer program or other complex tools....
 for the Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 and for Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 systems. Users direct the operation of the computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
 by entering command input as text for a command line interpreter
Command line interpreter

A command-line interpreter is a computer program that reads lines of text entered by a user and interprets them in the context of a given operating system or programming language....
 to execute or by creating text scripts of one or more such commands.

The most generic sense of the term shell
Shell (computing)

In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
 means any program that users use to type commands. Since in the Unix operating system users can select which shell they want to use (which program should execute when they log in), many shells have been developed. It is called a "shell" because it hides the details of the underlying operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 behind the shell's interface (in contrast with the "kernel", which refers to the lowest-level, or 'inner-most' component of an operating system). Similarly, graphical user interface
Graphical user interface

A graphical user interface is a type of user interface which allows people to human-computer interaction such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment....
s for Unix, such as GNOME
Gnome

A gnome is a mythical creature characterized by its extremely small size and wiktionary:subterranean lifestyle. The word gnome is derived from the New Latin gnomus....
, KDE
KDE

KDE is a free software project based around its flagship product, a desktop environment for Unix-like systems. The goal of the project is to provide basic desktop functions and applications for daily needs as well as tools and documentation for developers to write stand-alone applications for the system....
, and Xfce
Xfce

Xfce is a free software desktop environment for Unix and other Unix-like platforms, such as Linux, Solaris and BSD. It aims to be fast and lightweight, while still being visually appealing and easy to use....
 can be called visual shells or graphical shells. By itself, the term shell is usually associated with the command line. In Unix, any program can be the user's shell. Users who want to use a different syntax for typing commands can specify a different program as their shell, though in practice this usually requires administrator rights.

The term shell also refers to a particular program, such as the Bourne shell
Bourne shell

The Bourne shell, or sh, was the default Unix shell of Version 7 Unix, and replaced the Thompson shell, whose executable file had the same name, sh....
, sh. The Bourne shell was the shell used in early versions of Unix and became a de facto standard; every Unix-like system has at least one shell compatible with the Bourne shell. The Bourne shell program is located in the Unix file hierarchy at /bin/sh. On some systems, such as BSD
Berkeley Software Distribution

Berkeley Software Distribution is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995....
, /bin/sh is a Bourne shell or equivalent, but on other systems such as Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
, /bin/sh is likely to be a link
Symbolic link

In computing, a symbolic link is a special type of computer file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution....
 to a compatible, but more feature-rich shell. POSIX
POSIX

POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho...
 specifies its standard shell as a strict subset of the Korn shell
Korn shell

The Korn shell is a Unix shell which was developed by David Korn in the early 1980s. It is backwards-compatible with the Bourne shell and includes many features of the C shell as well, such as a command history, which was inspired by the requests of Bell Labs users....
.

Other types of shells

The Unix shell was unusual when it was first created. Since it is both an interactive command language
Shell (computing)

In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
 and the language used to script
Shell script

A shell script is a Scripting language written for the Shell , or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language....
 the system, it is a scripting programming language. Many shells created for other operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s offer rough equivalents to Unix shell functionality.

On systems using a windowing system
Windowing system

A windowing system is a component of a graphical user interface , and more specifically of a desktop environment, which supports the implementation of window managers, and provides basic support for graphics hardware, pointing devices such as mice, and keyboards....
, some users may never use the shell directly. On Unix systems, the shell is still the implementation language of system startup scripts, including the program that starts the windowing system, the programs that facilitate access to the Internet
Internet

The Internet is a global network of interconnected computers, enabling users to share information along multiple channels. Typically, a computer that connects to the Internet can access information from a vast array of available server and other computers by moving information from them to the computer's local memory....
, and many other essential functions.

On MS-DOS
MS-DOS

MS-DOS is an operating system commercialized by Microsoft. It was the most commonly used member of the DOS family of operating systems and was the main operating system for personal computers during the 1980s....
, OS/2
OS/2

OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "IBM Personal System/2 " line of second-generation personal computers....
, and Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
, equivalents to Unix system scripts are called batch files, and have either a ".bat" or ".cmd" extension
Filename extension

A filename extension is a substring to the filename of a computer file applied to indicate the encoding convention of its contents.In some operating systems it is optional, while in some others it is a requirement....
. A newer CLI - Windows PowerShell
Windows PowerShell

Windows PowerShell is an extensible command line interface shell and associated scripting language from Microsoft. It was released in 2006 and is currently available for Windows XP SP2/SP3, Windows Server 2003, Windows Vista and is included in Windows Server 2008 as well as Windows 7 as an optional feature....
, will replace the existing NT command line, cmd.exe
Cmd.exe

cmd.exe is the command line interpreter on OS/2, Windows CE and on Windows NT-based operating systems . It is the analog of COMMAND.COM in MS-DOS and Windows 9x systems, or of the Unix shells used on Unix-like systems....
; it has many features derived from Unix shells, though it uses a somewhat different syntax
Syntax

In linguistics, syntax is the study of the principles and rules for constructing Sentence s in natural languages. In addition to referring to the discipline, the term syntax is also used to refer directly to the rules and principles that govern the sentence structure of any individual language, as in "the Irish syntax"....
.

Many users of a Unix system still find a modern command line shell much more convenient for many tasks than any GUI
Gui

Gui or guee is a generic term to refer to grillinged dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients....
 application
Application software

Application software is any tool that functions and is operated by means of a computer, with the purpose of supporting or improving the software user 's work....
.

Due to the recent movement in favor of open source
Open source

Open source is an approach to design, development, and distribution offering practical accessibility to a product's source . Some consider open source as one of various possible design approaches, while others consider it a critical Strategy element of their business operations....
, most Unix shells have at least one version that is open source.

Shell categories

Unix shells can be broadly divided into four categories: Bourne-like, C Shell-like, nontraditional, and historical.

Bourne shell compatible

  • Bourne shell
    Bourne shell

    The Bourne shell, or sh, was the default Unix shell of Version 7 Unix, and replaced the Thompson shell, whose executable file had the same name, sh....
     (sh) -- Written by Steve Bourne, while at Bell Labs
    Bell Labs

    Bell Laboratories is the research organization of Alcatel-Lucent and previously of the American Telephone & Telegraph Company .Bell Laboratories has had its headquarters at Berkeley Heights, New Jersey, and it has research and development facilities throughout the world....
    . First distributed with Version 7 Unix
    Version 7 Unix

    Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system....
    , circa 1978, and enhanced over the years.
    • Almquist shell
      Almquist shell

      The Almquist shell was originally Kenneth Almquist's clone of the SVR4-variant of the Bourne shell; it is a fast, small, POSIX-compatible Unix shell designed to replace the Bourne shell in later BSD distributions....
       (ash) -- Written as a BSD-licensed replacement for the Bourne Shell; often used in resource-constrained environments. The sh of FreeBSD
      FreeBSD

      FreeBSD is a Unix-like free software operating system descended from AT&T Unix via the Berkeley Software Distribution branch through the 386BSD and Berkeley Software Distribution#4.4BSD and descendants operating systems....
      , NetBSD
      NetBSD

      NetBSD is a freely redistributable, open source version of the Unix-derivative Berkeley Software Distribution computer operating system. It was the second open source BSD descendant to be formally released, after 386BSD, and continues to be actively developed....
       (and their derivatives) are based on ash that has been enhanced to be POSIX
      POSIX

      POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho...
       conformant for the occasion.
    • Bourne-Again shell (bash) -- Written as part of the GNU
      GNU

      GNU is a computer operating system composed entirely of free software. Its name is a recursive acronym for GNU's Not Unix; it was chosen because its design is Unix-like, but differs from Unix by being free software and containing no Unix code....
       project to provide a superset of Bourne Shell functionality.
    • Debian Almquist shell
      Debian Almquist shell

      Debian Almquist shell is a Unix shell, much smaller than bash but still aiming at POSIX-compliancy. It requires less disk space but is also less feature-rich....
       (dash) -- Dash is a modern replacement for ash in Debian
      Debian

      Debian GNU/Linux is one of the most popular and influential computer operating systems composed of free software and open source software....
      .
    • Korn shell
      Korn shell

      The Korn shell is a Unix shell which was developed by David Korn in the early 1980s. It is backwards-compatible with the Bourne shell and includes many features of the C shell as well, such as a command history, which was inspired by the requests of Bell Labs users....
       (ksh) -- Written by David Korn, while at Bell Labs
      Bell Labs

      Bell Laboratories is the research organization of Alcatel-Lucent and previously of the American Telephone & Telegraph Company .Bell Laboratories has had its headquarters at Berkeley Heights, New Jersey, and it has research and development facilities throughout the world....
      .
    • Z shell
      Z shell

      The Z shell is a Unix shell that can be used as an interactive login shell and as a powerful command line interpreter for shell scripting. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some of the most useful features of bash, Korn shell, and tcsh....
       (zsh) -- considered as the most complete (read: the most features) shell: it is the closest thing that exists to a superset of sh, ash, bash, csh, ksh, and tcsh.
    • Busybox
      BusyBox

      BusyBox is a software application that provides many standard Unix tools, much like the larger GNU Core Utilities. BusyBox is designed to be a small executable for use with Linux, which makes it ideal for special purpose Linux distributions and embedded devices....
       -- Tiny utilities for small and embedded systems, include a shell.


C shell compatible

  • C shell
    C shell

    The C shell is a Unix shell developed by Bill Joy for the Berkeley Software Distribution Unix system. It was originally derived from the 6th Edition Unix /bin/sh , the predecessor of the Bourne shell....
     (csh) Written by Bill Joy
    Bill Joy

    William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy, Andy Bechtolsheim and Vaughan Ronald Pratt, and served as chief scientist at the company until 2003....
    , while at the University of California, Berkeley
    University of California, Berkeley

    The University of California, Berkeley is a public university research university located in Berkeley, California, California, United States. The oldest of the ten major campuses affiliated with the University of California, Berkeley offers some 300 undergraduate and graduate degree programs in a wide range of disciplines....
    . First distributed with BSD, circa 1979.
    • TENEX C shell (tcsh)


Other or exotic

  • fish
    Friendly interactive shell

    fish is a Unix shell. Its name is an acronym for friendly interactive shell. fish focuses on interactive use, discoverability, and user friendliness....
    , friendly interactive shell, first released in 2005.
  • mudsh, an "intelligent" game-like shell that operates like a MUD
    MUD

    In Online game, a MUD , pronounced /m?d/, is a multi-user real-time virtual world described entirely in text. It combines elements of role-playing games, hack and slash, interactive fiction, and online chat....
    .
  • zoidberg, a modular Perl shell written, configured, and operated entirely in Perl
    Perl

    In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
    .
  • rc, the default shell on Plan 9 from Bell Labs
    Plan 9 from Bell Labs

    Plan 9 from Bell Labs is a distributed operating system, primarily used for research. It was developed as the research successor to Unix by the Computing Sciences Research Center at Bell Labs between the mid-1980s and 2002....
     and Version 10 Unix
    Version 10 Unix

    Tenth Edition Unix, also known as Version 10 Unix or V10, was the last version of the Research Unix operating system developed and used internally at Bell Labs....
     written by Tom Duff
    Tom Duff

    Thomas Douglas Selkirk Duff is a computer programmer. He was born in Toronto, Ontario, Canada and grew up in Toronto and Leaside, Ontario. In 1974 he graduated from the University of Waterloo with a B.Math and, two years later, got an M.Sc....
    . Ports have been made to Inferno
    Inferno (operating system)

    Inferno is an operating system for creating and supporting distributed services.It was based on the experience of Plan 9 from Bell Labs, and the further research of Bell Labs into operating systems, languages, on-the-fly compilers, graphics, security, networking and portability....
     and Unix-like
    Unix-like

    A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
     operating systems.
    • es shell
      Es shell

      The es shell is a command line interpreter developed by Byron Rakitzis and Paul Haahr, that uses a scripting language similar to the rc shell of the Plan 9 from Bell Labs operating system....
       (es) A functional programming
      Functional programming

      In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data....
       rc-compatible shell written in the mid-1990s.
  • scsh
    Scsh

    Scsh is a POSIX API layered on top of the Scheme in a manner to make the most of Scheme's capability for scripting. It is limited to 32-bit platforms....
     (Scheme Shell)


A list of various shells may be found at .

Configuration files for shells

Shells read configuration files on multiple circumstances which differ depending on the shell. This table shows the configuration files for popular shells:
 shkshcshtcshbashzsh
/etc/.loginloginlogin
/etc/csh.cshrc yes
/etc/csh.loginlogin
~/.tcshrc yes
~/.cshrcyes yes
~/.login loginlogin
~/.logout loginlogin
/etc/profileloginlogin i.login
~/.profileloginlogin login
~/.bash_profile login
~/.bash_login login
~/.bash_logout login
~/.bashrc n/login
/etc/zshenv yes
/etc/zprofile login
/etc/zshrc int.
/etc/zlogin login
/etc/zlogout login
~/.zshenv yes
~/.zprofile login
~/.zshrc int.
~/.zlogin login
~/.zlogout login


Explanation:
  • blank means a file is not read by a shell at all.
  • "yes" means a file is always read by a shell.
  • "login" means a file is read if the shell is a login shell.
  • "n/login" means a file is read if the shell is not a login shell.
  • "int." means a file is read if the shell is interactive.
  • "i.login" means a file is read if the shell is an interactive login shell.


Historic

  • Thompson shell
    Thompson shell

    The Thompson shell was the first Unix shell, introduced in the first version of Unix in 1971, and was written by Ken Thompson . It was a simple command interpreter, not designed for scripting, but nonetheless introduced several innovative features to the command line interface and led to the development of the later Unix shells....
     (sh) -- The first Unix shell, written by Ken Thompson at Bell Labs
    Bell Labs

    Bell Laboratories is the research organization of Alcatel-Lucent and previously of the American Telephone & Telegraph Company .Bell Laboratories has had its headquarters at Berkeley Heights, New Jersey, and it has research and development facilities throughout the world....
    . Distributed with Versions 1 through 6 of Unix, from 1971 to 1975. Considered very rudimentary by modern standards and not used on current systems, though available as part of some Ancient UNIX Systems
    Ancient UNIX Systems

    Ancient UNIX is a term coined by Santa Cruz Operation to describe early releases of the Unix code base released prior to Unix System III, particularly the Research Unix releases prior to and including Version 7 ....
    .
  • PWB shell
    PWB shell

    The PWB shell was an early Unix shell distributed with some versions of Programmer's Workbench UNIX circa 1975-1977. It was a modified version of the Thompson shell with additional features to increase usability for programming, and was maintained by John Mashey and various others ....
      or Mashey shell (sh) -- A version of the Thompson shell, augmented by John Mashey
    John Mashey

    John Mashey started work on Unix at Bell Labs in 1973, and continuing to work there for 10 years. He was the principal maintainer of the PWB shell, more popularly known as the "Mashey Shell"....
     and others, while at Bell Labs
    Bell Labs

    Bell Laboratories is the research organization of Alcatel-Lucent and previously of the American Telephone & Telegraph Company .Bell Laboratories has had its headquarters at Berkeley Heights, New Jersey, and it has research and development facilities throughout the world....
    . Distributed with the Programmer's Workbench UNIX, circa 1976.


Non-Unix shells

Within the Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 suite of operating systems the analogous programs are command.com
COMMAND.COM

COMMAND.COM is the filename of the default operating system Shell for DOS operating systems and the default command line interpreter on 16/32-bit versions of Microsoft Windows ....
, or cmd.exe
Cmd.exe

cmd.exe is the command line interpreter on OS/2, Windows CE and on Windows NT-based operating systems . It is the analog of COMMAND.COM in MS-DOS and Windows 9x systems, or of the Unix shells used on Unix-like systems....
 for Windows NT
Windows NT

Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was originally designed to be a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix....
-based operating systems, and Windows PowerShell
Windows PowerShell

Windows PowerShell is an extensible command line interface shell and associated scripting language from Microsoft. It was released in 2006 and is currently available for Windows XP SP2/SP3, Windows Server 2003, Windows Vista and is included in Windows Server 2008 as well as Windows 7 as an optional feature....
 introduced with Windows Server 2008.

See also

  • Shell (computing)
    Shell (computing)

    In computing, a shell is a piece of software that provides an Interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel ....
  • Comparison of command shells
  • Shell script
    Shell script

    A shell script is a Scripting language written for the Shell , or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language....
  • List of Unix programs
    List of Unix programs

    This is a list of UNIX utilities as specified by IEEE Std 1003.1-2004, which is part of the Single UNIX Specification .These utilities can be found on UNIX Operating systems and most UNIX-like operating systems....
  • Shell account
    Shell account

    A shell account is a personal account that gives a user access to a Unix shell on a remote server, usually accessed through Secure Shell . A shell account can be used for many different purposes because many different programs can be run on the shell....


Further reading

  • — a history of the various shells, and the uses of and responsibilities of a shell on Unix


External links