Shell Unix

A Unix shell is a command shell for Unix and Unix operating systems that provides access to internal operating system features. It is presented in the form of a command line interface accessible from the console or a terminal . The user initiates commands as a text entry that is then executed by the shell. In the various Microsoft Windows operating systems , the analogue program is , or cmd.exe .

Like operating systems Unix have mostly a shell. Originally , the shell was sh , which evolved in many versions, including csh , extended in tcsh , or ksh , or rc … But today bash , drawing inspiration from sh , Ksh , and csh , is the most common shell, although there are other shells, such as zsh , or ash .

Unix shell history

The first shell is the Thompson shell  (en) appeared in 1971 for the first version of Unix . This version of the shell was written by Ken Thompson, one of the creators of Unix . It was replaced by the Bourne shell , written by Stephen Bourne , in 1977 for version 7 of Unix .

In 1978, Bill Joy , a student at the University of California at Berkeley , creates csh (C shell) a shell evolution whose syntax is inspired by that of the language C. It allowed in particular the reuse of the history of the commands. A more modern version of the Csh has been published under the name tcsh .

The Korn shell (ksh) was published in 1983 by David Korn . It is compatible with the Bourne shell , takes over some features from csh and adds advanced scripting functions available in more advanced languages ​​such as Perl .

The Bourne-Again shell (bash) appeared in 1988. It was written by Brian Fox for the Free Software Foundation as part of the GNU project . This is the shell of many free Unix implementations , such as GNU / Linux systems . It is compatible with the Bourne shell which it wants to be a free implementation.

Paul Falstad created Zsh in 1990 while studying at Princeton University . This shell takes the most practical functions of bash , Csh , tcsh .


  • Shell by Stephen Bourne
    • Bourne shell (sh)
    • Bourne-Again shell (bash)
  • Csh : C shell
    • Tcsh (Tenex C shell, modern version of csh)
  • Shell by David Korn : Korn shell (ksh)
  • Shell Kenneth Almquis  (in) , used when it is necessary to have a shell takes up little space on the disk, clone SVR4 version of the Bourne shell;
    • Ash (Almquist SHell)
    • Dash shell ( Debian Almquist Shell)
  • Z Shell (zsh), taking the most practical functions of bash, ksh and tcsh.
  • Fish


This section is empty, insufficiently detailed or incomplete. Your help is welcome!

Input / Output Management and Redirection

The shells are used to perform redirects. A redirection involves redirecting the input or output of a command to another command or file.

Simple right redirection


 Command> file

The result of invoking the command commandewill be written to the file fichier, overwriting the previous content.


$: Cat file
$: Echo "Hello world" > file
$: Cat file
Bonjour Monde

Redirect double right


 Order >> file

The result of invoking the command commandewill be written to the file fichier, following the data already present.


$: Cat file
$: Echo "Hello world" >> file
$: Cat file
Bonjour Monde

Simple left redirection


 Command <file

The command commandewill read the contents of the file fichierinstead of reading on the standard input (keyboard).


$: Cat <filename

Left double redirection


 Command << END

The command commandewill read on the standard input until the word following the double redirection is encountered.


$: Cat << TOTO
? Foo
? Bar
? Moomoo



Command_1 | Command_2

The result of the command commande_1will be redirected to the input of the second command commande_2.


$: Echo "Hello world" | Grep -o "Hello"

Configuration file

Sh Ksh Csh Tcsh Bash Zsh
/etc/.login login login
/etc/csh.cshrc Yes Yes
/etc/csh.login login login
~ / .tcshrc Yes
~ / .cshrc Yes Yes note 1
~ / Etc / ksh.kshrc Int.
/etc/sh.shrc Int. Note 2
$ ENV (typically ~ / .kshrc) 1 Int. Note 3 note 4 Int. Int. Note 5
~ / .login login login
~ / .logout login login
/ Etc / profile login login login Login note 6
~ / .profile login login Login note 7 Login note 6
~ / .bash_profile Login note 7
~ / .bash_login Login note 7
~ / .bash_logout login
~ / .bashrc Int. + 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

Notes and references


  1. ↑ only if ~ / .tcshrc not found
  2. ↑ Newer versions of the Bourne shell only
  3. ↑ Available on systems That Support the “User Portability Utilities Option”; IDs or real group IDs are different. “” The value of the variable must be an absolute path, and it is ignored. ” 2
  4. ↑ $ ENV is $ HOME / .shrc in newer versions of the Bourne Shell
  5. ↑ Same behavior as sh , if only goal Invoked as sh (bash 2+) gold, since bash 4.2, aussi if Invoked Explicitly in POSIX compatibility mode (with options --posix gold -o posix ) 3 .
  6. a and b Only in sh / ksh compatibility mode (when invoked as bash, sh, ksh)
  7. a , b and c in fact, the first readable of ~ / .bash_profile , ~ / .bash_login and ~ / .profile ; and only ~ / .profile if Invoked as sh gold, as of at least 4.2 Bash, if Invoked Explicitly in POSIX compatibility mode (with options --posix gold -o posix )


  1. ↑ SCO Unix Group, SCO Unixware 7 documentation, 22 Apr 2004, retrieved 18 Oct 2012  [ archive ] .
  2. ↑ ( in ) ” Shell Command Language [ archive ] , (accessed 15 June 2015 )
  3. ↑ ( in ) ” Bash Reference Manual: Bash Startup Files [ archive ] , (accessed 15 June 2015 )

Brian Blackmore, ” UNIX shell differences [ archive ] (accessed February 13, 2012 )