Unix Shells

Aug 13, 2011·
Julio Batista Silva
Julio Batista Silva
· 3 min read
blog Linux

A Unix Shell, in the sense I will use here, is a command line interpreter that gives the user an interface for operating Unix or Unix-like systems. Over the years, several shells have been developed with different characteristics. Here I will briefly comment on the best known shells and share tips for configuring the shell I use.

In the following diagram are the six most popular shells, arranged so that a shell on a lower level extends the functions of the shell above it. Shells on different branches are incompatible.

csh (C shell)      sh (Bourne shell)
      |               /         \
      |               |     ksh (Korn shell)
      |               |          |
tcsh (TC shell)      bash    zsh (Z shell)
  1. C shell (csh)

    Created by Bill Joy while a student at UC Berkeley, it was released in 1978 as part of BSD. It was popular for writing scripts, since its syntax resembles the C language, but it is criticized for flaws in its implementation.

  2. TC shell (tcsh)

    Tcsh is essentially the C Shell with a few extra features, such as tab completion, a command editor and better history handling.

  3. Bourne Shell (sh)

    This is the traditional shell developed by Stephen Bourne at Bell Labs and released in 1977. It was the default shell of Unix7 and more recent versions are still widely used today.

  4. Bourne-again Shell (Bash)

    Written by Brian Fox for the GNU project, it was released in 1989 to replace the Bourne Shell and add a number of features. It is very widely used because it is the default shell of several Linux distributions and of Mac OS X.

  5. Korn shell (ksh)

    It was developed by David Korn at AT&T Bell Labs and released in 1983. It is very popular because it is fully compatible with the Bourne Shell and has a number of other features, some copied from the C Shell.

  6. Z shell (zsh)

    It was written in 1990 by Paul Falstad, then a student at Princeton University, and it is the most complete shell on this list. It can be seen as an extension of the Bourne Shell with several improvements based on bash, ksh and tcsh, and it also has features of its own, including a spell checker.

Since Zsh is my favorite shell, I will write more about installing and configuring it (on Arch Linux).

  1. In /etc/shells, check the list of installed shells. If zsh does not show up in that list, install it.

    $ sudo pacman -S zsh
    
  2. Test the installation and set the basic options

    $ zsh
    
  3. Make Zsh your default shell (applied after logging in again).

    $ chsh -s $(which zsh)
    
  4. Edit the main configuration file, ~/.zshrc.

    An easy way to edit the file is through Oh My ZShell:

    git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    chsh -s /bin/zsh
    

    I keep a copy of my own configuration at https://github.com/jbsilva/dotfiles.


Julio Batista Silva
Authors
Senior Cloud Developer

I’m a Brazilian-German computer engineer based in Germany, passionate about tech, science, photography, and languages.

I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.

I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, serving on the PSF D&I Work Group, mentoring, and contributing code and translations.

On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.

Browse my gallery for some of my photography.

Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.

Always happy to connect! 🙂

comments powered by Disqus