Unix/Linux operating system has two main components we concern here. Both parts are used to perform any operation on os/system.

  1. Kernel
  2. Shell

What is a kernel? A minimum detail.

Kernel is a program or tool, It is also famous by the name ‘Heart or core of the operating system’. Because every operation performed on an operating system has been made done by the Kernel. In year 1991, Linus Torvalds developed the Linux kernel

Kernel’s code is stored in a special memory area to keep it protected from other system codes.

Its main functionalities are:

  • Process management
  • Management Hardware devices
  • Handling interrupts
  • Memory management
  • File handling
  • Network management

And many more management’s responsibility took by Kernel.

What is a Shell?

The shell is a command line language interpreter. So also named as  ‘command interpreter’. It works as an interface between a user and the Kernel. Users can interact with operating system(Kernel) through a program called shell. Shell’s main responsibilities are to:

  • Read the commands written on a file or typed by user and after translating those into machine language pass to the Kernel for the execution.
  • Get the output or result from the Kernel and shows it to the user on the standard output device e.g computer screen.

User can access a shell by running a program called ‘Terminal’, on Linux/Unix and Mac OSX operating systems, and Command prompt on Window system. All the typed commands on the terminal have received by the shell.

A shell has its own programming language with all the features any standard programming language have. i.e Variables, Conditions, Loops e.t.c

A collection of commands written in its language can be named as script.

Login shell vs non-login shell

Login shell always run at the time of user login. It’s main purpose is to do the configurations required by a user in work environment. While a non-login shell is a shell opened after login in the system by user or by an automated script.

Interactive shell vs non Interactive shell

Basically, shells have 2 purposes. First is to run the commands entered by user or run commands written in a script file.

As the term “Interactive” implies that a shell started by user and commands are also run with user interaction. That type of shell can prompt to enter the data by user. On the other side “Non Interactive” shells probably run by an automated process or script so all the inputs to that shell will also be given by that script.

History of Shells evolution and Famous linux shells

1.Ken Thompson shell (V6 shell)

Ken Thompson (at AT&T Bell Labs by Nokia) developed the first shell for UNIX called the V6 shell in 1971. Similar to its predecessor in Multics, this shell (/bin/sh) was an independent user program that executed outside of the kernel. Concepts like globbing (pattern matching for parameter expansion, such as *.txt) were implemented in a separate utility called glob, as was the if command to evaluate conditional expressions. This separation kept the shell small, at under 900 lines of C source.

Link to download Thompson shell original source code. https://github.com/shuaibimran/Thompson-Shell

2.Bash shell (sh shell)

In year 1977 a developer Stephen bourne developed a shell for V7-UNIX. That shell’s name was set on his own name and that shell became famous by the Bourne shell or sh shell. Stephen was working in a company whose name was AT&T Bell Labs. Yes! It was the same company where Ken Thompson developed V6-Shell 6 years ago.

The main goal behind the development of bash shell was to add the support to write shell script. i.e Write multiple commands in a file and execute them with one click.

Bash shell has become the default shell for many Linux distributions in the market. It has very advanced scripting support as compared to the first shell i.e

  • Variables support
  • Control flow statements
  • Loops
  • Functions

It also has many advance features like

  • Command line editing
  • Job control
  • Unlimited history maintaining size
  • Up to base64 integer calculations support

3.C shell (csh shell)

In year 1978 Bill Joy, a graduate student at the University of California, Berkeley, developed C shell. While studying in university he was working for Berkeley Software Distribution (BSD) UNIX systems.

csh is a command processor typically run in a text window. As like other shells user can type commands on it and it also has the ability to read commands from a file or in other words script.

As the C language was very famous at that time, Bill joy tried to make its scripting very similar to the C language. A very prominent and useful feature introduced in the C shell was the ‘Commands History’ maintaining.

4.Tenex C shell (tcsh shell)

After 5 years of C shell’s birth, In the year 1983, Ken Greer at Carnegie Mellon University developed Tenex shell. tcsh is a superset of the C shell. It means it retains all the features of its predecessor and also add some of its own features and functionalities. Like

  • To edit the text on the command line, it has the ability to use keystrokes from Emacs word processor program.
  • File name setting
  • Command completion or in other words intellisense. Inspired from TENEX.
  • Wildcard matching
  • Alias argument selectors

On many famous operating systems, like Mac OSX or Red Hat Linux tcsh has been used.

Note: Tenex is an operating system. It manages computer hardware, software resources, and provides common services for computer programs.

5.Korn shell (ksh shell)

In the same year when Ken Greer introduced tcsh, another developer, David Korn, bugle the news of Korn shell. At that time, David Korn was working at Bell Labs. Yes! Again a big contribution by the same company where Ken Thompson developed V6 Shell in 1971 and Stephen developed Bourne Again shell (bash shell) in 1977.

At the time of its launching, Korn shell was under the proprietary license. But in late 2000, they make it open source, under the Common Public License.

Korn shell was the most comprehensive and feature rich shell of that time. Korn shell incorporated all the features of the C shell (csh) and Tenex C shell (tcsh), and scripting feature like the Bourne shell (sh). Few listed features rocket its fame:

  • History feature from the C shell (csh)
  • Associative arrays and floating points from Python and Ruby like most advanced languages

Korn shell is the most preferred choice of beginners and commercial environments because of its simplicity and efficiency. It is a part of many famous operating systems like IBM’s AIX and HP-UX.

6.Bourne-Again shell (bash shell)

In the scripting world, GNU Bourne-Again shell (bash) appeared as a giant. Brian Fox was the developed the bash shell in year 1989. Bash shell is the default shell on many operating systems and also supported by a variety of Linux distributions, as well as UNIX operating systems:

  • Linux
  • Darwin
  • Windows
  • Cygwin
  • Novell
  • Haiku

and many more.

As its name implies, it is developed by supersetting the bourne shell (sh). So bash is compatible to its predecessor the sh shell, and most of the scripts written in sh can work on it flawlessly. At the time of its launch it was POSIX standards compliant, but as the time passed many extensions happened and it became a POSIX diversified shell.

Bash shell capture many features from other shells like C shell and Korn shell too.

  • Command history
  • Command line editing
  • Directory stack
  • Command completion (intellisense)
  • Associative arrays
  • Regular expressions parsing support
  • Shell functions and Alias support
  • Multitasking (Run multiple programs in background at once)

Because of its simplicity, too much support on community and as well as by developers, and widely taught in universities, colleges and by professionals, it becomes the most widely used and preferred shell for scripting for beginners.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.