Types of shells in Linux
What is SHELL?
1. It is an interface between user and kernel.
2. It is an interpreter that executes the commands given by the user.
3. Shell is not a part of the kernel but it uses the kernel to execute the commands.
4. 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.
5. 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 shells available in our Linux the command is as follows.
[root@sys3 ~]# cat /etc/shells
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 that user there is no need to have a shell to download the files.
- At that situation as an admin our duty is to create the user 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.
- The binary executable files or commands stored in /sbin are permitted to be executed by the root or super user only. /sbin represents super user binary executable files.
What are the different shells represent?
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.
How to know the default working Shell?
To know the default shell of the particular operating system the command is as follows.
[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”.
How to check our current working shell?
To check the current working shell type the command # echo $0.
[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