Types of shells in Linux

There are different types of shells available on any linux machine. Primarily we need to understand about, Bourne shell, Korn shell and bash shell etc. But before getting into types of shell, let's understand a bit more on Shell.


What is SHELL?



It is an interface between user and kernel. It is an interpreter that executes the commands given by the user. Shell is not a part of the kernel but it uses the kernel to execute the commands.

Every shell will do the same tasks or functions but the syntax of commands are different for different shells and provide different built-in functions.

In MS-DOS the shell is command.com and the shell in windows the shell is power shell.


What are the shells available on Linux?

  • Some shells are available in the RHEL are c-shell, bash shell, korn shell etc.,
  • To know the list of shells available on our Linux, the command is as follows.
[root@sys3 ~]# cat /etc/shells


1. /bin/sh represents Bourne shell which is default shell in solaris.

2. /bin/bash represents Bourne again shell. This shell is improved version of Bourne shell. This is the default shell in Linux.

3. /bin/dash represents DebianAlmquist shell. It is the default shell in Debian OS.

4. /bin/csh represents c-shell.

5. /bin/tcshtepresents advanced c-shell.

What is “/sbin/nologin”?

From the above output all shells are available in /bin directory. Except for one thing that is “/sbin/nologin”.

  • /sbin/nologin - represents the no shell.

For example I am creating a user for the authentication of FTP server. For this user there is no need to have a shell to download the files. At that situation as an admin we can create a userid with no shell.

This makes possible by using “/sbin/nologin” with attribute –s of “useradd” command. To know about creating the user having noshell click here.


This attribute is performed by the administrator only. Because of that it lies on /sbin directory.  /sbin represents super user binary executable files.


How to know the default working Shell?

To know the default shell of the particular Linux operating system the command is,

[root@sys3 ~]# echo $SHELL


How to go from one shell to another shell?

To change the current working shell simply enter the individual shell command in the terminal.

If you want to change the shell from bash to c- shell simply enter the command as “csh”. To change to bash shell, type "bash" in terminal window.


How to check our current working shell?

To check the current working shell type the command # echo $0.

[root@sys3 ~]#csh
[root@sys3 ~]# echo $0


How to revert back to the previous shell?

To revert from that shell simply type "exit" on the terminal.

[root@sys3 ~]# exit
[root@sys3 ~]# echo $0


Topics Summary