A Unix/Linux Operating System may have more than one shell installed.
You can type the following command in your terminal to see which shell you are using:
Below is the list,
- Bourne Shell – sh
- C Shell – csh
- T Shell – tcsh
- Korn Shell – ksh
- Bourn-again Shell – bash
- Dash Shell
- Z shell
This list is not complete and there are many other shells.
/etc/shells file stores list of all shells installed in your system. Simply, run the below command to find out the installed shells,
$ cat /etc/shells
Run grep command on /etc/passwd file to know the default shell when you log in to Unix or Linux operating system.
$ grep john /etc/passwd
You can also use the $SHELL variable for the same purpose.
echo $0
$ echo $SHELL
The result will look something similar to the below if you are using the bash (Bourne Again Shell) terminal:
When there are multiple shells installed on your system, you can always switch the shell.
so how do you know which shell you are running at the moment?
Simply use the below command
-bash
$ ps -p $$
I think all your questions are answered. If you still have a doubt, you can refer to this source article.
tcsh/csh
has its current shell in$shell