Just another “Unix and Linux shells” article

Traditionally, the default shell in the Unix systems is dash, for both the users and the system scripts. On GNU / Linux distros, bash has always been the default shell.

Some new GNU / Linux distros use dash  as the default shell for the system scripts and bash for the users.

There are a lot of different shells, written for a particular purpose. Each shell has it’s own syntax and feature set. (Examples: one, two)

The main benefit for using the same shell for both user and system scripts is that you can easily test your syntax. To invoke a new shell, just type the shell’s name in the terminal:

$ zsh
$ bash
$ tcsh

Historical information:

The Bourne Shell was created in 1979 by Stephan Bourne.

The Korn Shell was created in 1983 by David Korn.

The C Shell was created in the 1970s by Bill Joy.

The Z Shell was created by in 1990 by Paul Falstad.

The Almquist was created in 1989 by Kenneth Almquist. It was ported to Debian in 1999 by Herbert Xu as the Debian Almquist Shell (dash).

The innovations brought by each shell:

The Bourne Shell: sh

The Bourne Shell is a very basic shell.

While the shells are prefixed: ksh, bash, zsh, the The Bourne Shell is sh, “the shell”, because it was the first one.
The Bourne Shell provided the pipeline, the structure that allows a process tho pass its output to the input of another process. After the variables were introduced, the Bourne shell became more flexible.

The Korn Shell: ksh

The Korn shell is very popular for both, system scripts and interactive usage. It is a Bourn Shell compatible shell. In the Ksh shell, the cursor-key navigation of the shell history was introduced. Because of some proprietary licence issues ksh was named pdksh on some Unix distros, and mksh or ksh93 on others. When you see ksh on your system, it is for sure the genuine ksh93 and not a copy.

Microsoft tried to create a ksh-compatible shell, based on the mksh, but the project was not successful.

The C Shell: csh

The C shell is more C like than the other and more interactive than the Bourne shell. The history command was first introduced in csh. It also added the job control and the concent of tilde (~) to represent the current user’s homedir. All this features were imported in the other shells.

The Tenex C Shell: tcsh

The tcsh shell is an improved csh-compatible shell. The tcsh innovations are: the pushd and popd for navigation on the directory stack, terminal locking, the spelling correction feature and auto completion of the commands and filenames and variables.

The Z Shell: zsh

The Z shell is an improved ksh-compatible shell with some csh-like features. The zsh shell is a good interactive shell and has a more efficient command completion than bash. Zsh’s popularity has increased in the last years.

The Born Again Shell: bash

Bash is very popular in GNU/Linux and Mac OSX, and becoming popular with traditional Unix users, too. It is a sh-compatible shell, with some ksh features.

The Debian Almquist Shell dash

Dash is a POSIX-compliant shell. It has replaced the sh shell on some Linux distros because it is much faster.

The generical configuration file for the shells is /etc/profile. Also, every shell has it’s own configuration files in /etc and in the user’s homedir.

Tagged with: , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!