Introduction to Shells in Linux
What is a shell? A shell is a program that acts as an interface between the user and the operating system (OS) kernel. Shells have evolved with time; the first shell that came to the world was the Thompson shell which was written by ken Thompson at AT&T Bell Labs. It was distributed with Versions 1 through 6 of Unix, from 1971 to 1975. Soon, what we got was the Bourne shell which was developed by Stephen Bourne at Bell Labs, which was distributed as the shell for UNIX Version 7 in 1979. The Thompson shell was not a scripting shell and soon it was replaced by Bourne shell as which was accompanied by many improvements.
Types of Shells in Linux
Following are the different types of Shells
1. The Bourne Shell
The Bourne shell was developed by Stephen Bourne at Bell Labs and distributed as the shell for Unix version 7 in the year 1979. This shell is denoted by This shell is faster and but lacks features such as being interactive. It is also the Solaris system default shell. The command full name path in Bourne shell is /bin/shand /bin/sh. Root user prompt is # while the non-root user prompt is $.
2. Bash Shell
The Bash Shell stands for Bourne again shell and it is the default shell of many Linux distributions today. This shell is very well compatible with the bourne shell and carries many improvements over the bourne shell. Some of the improvements are Job control, command-line editing, unlimited size command history, etc.
Below are some of the examples of commands:
|Operations on file||mv||This command is used to move or rename a file or a directory|
|cp||This command will copy a file or a directory.|
|touch||This will create an empty file and can also be used to update last-modified time|
|rm||This command is used to delete a file.|
|Directories||pwd||This will display the present working directory|
|ls||This is used to list all the files and directories of the present working directory where you are located in.|
|mkdir||This command will create a new directory.|
|cd||It will change the directory; can be a relative or absolute path|
|rmdir||removes the directory with the given name (the directory must be empty)|
Illustration of Commands
3. The C Shell
The C Shell is denoted by csh. It was created by Bill Joy in the year 1970 at the University of California at Berkeley. It is a command processor and it runs in a command window.bin/csh is the command full pathname, the root user default prompt is # while non-root user default prompt is hostname %.
Some of the options of c shell are-SYNOPSIS: csh -l
|b||This argument when passed with csh – will force a break from option processing.|
|e||This can be used to exit from the c shell|
|H||This will start the c shell in hidden mode.|
|s||This will read the command input from standard input.|
4. TENEX c shell
This is an improvement over the c shell and can be used as a shell script command processor as well as an interactive login shell. It is an enhanced yet completely compatible version of the c shell. It is denoted by tcsh and some of the main features are:
- Command-line editing
- Command-line completion
- Job control
- C like syntax
5. The Korn Shell
The Korn Shell is denoted by ksh and it was written and developed by David Korn in the year 1980. It incorporated all the features from the c shell (csh) and tab c shell (tcsh). It is faster than C shell and is a powerful high-level programming language. The full pathname of the command is /bin/ksh, the root user default prompt is # while the non-root default user prompt is $.
4.5 (2,918 ratings)
In ksh, a Metacharacter is one of the following characters:
- Command-line editing
- New cd capabilities – This enables users to return to the previous directory without typing complete pathname.
- Job control- Job running in ksh shell can be pushed to the background using commands like bg and can be stopped as well.
- History mechanism – A file called .sh_history stores all the commands that get executes in ksh shell and can be later displayed by running the command history.
- Tilde expansion – The home directory of any user can be referred to using ~ i.e. tilde character.
6. The Z Shell
The Z Shell is denoted by zsh and is an extension to bourne shell with many improvements and is used as an interactive login shell. It combines features from Bash, ksh and tcsh shell. It is also used as a command interpreter for shell scripting. Some of the important features of z shell are:
- Plugin and theme support
- Filename generation
- Concept index
- Functions index
- Spelling correction and approximate completion
- Automatic cd
- Login/Logout watching
7. Fish Shell
The Fish Shell is a user-friendly shell that was developed in the year 2005. Unlike its competitors, fish is not based on the Bourne shell or the C shell.
To install fish on your Ubuntu systems, we can run below commands:
- sudo apt-add-repository ppa:fish-shell/release-3
- sudo apt update
- sudo apt install fish
To install it on mac os: Brew install fish
To install fish on windows: If you are using windows 10, then one can install fish on windows subsystem for Linux and issue:
sudo apt install fish
However, if you have windows OS other than 10, then we can use Cygwin to install fish.
- It is having web-based configurations
- It supports 256 terminal technology
- Tab completion abbreviations.
- Wait for command: which waits for background processes
- Variables can also be used as commands
Conclusion – Types of Shells in Linux
In this article, we have learned about different types of shells. But the list doesn’t end here, there are many other shells as well but we have covered the top shells that are being evolved to date.
This is a guide to Types of Shells in Linux. Here we discuss Different Types of Shells in Linux in detail with images for better understanding. You can also go through our other related articles to learn more-
- Linux File System
- What is Linux?
- What is Unix Shell?
- Spark Shell Commands
- Guide to the List of Unix Shell Commands
- Guide to Top Most Linux Operators
- Types of Function in Shell Scripting
- Echo in Shell Scripting | How to Work? | Examples
- What is Shell in Linux? | Types and Examples
- Syntax and Advantages Bash Shell in Linux