How to check which shell is in use in Linux

Linux-based operating systems rely heavily on using shells for their various tasks, such as creating a text file; these actions are done through the operating system’s shells. There exist different types of shells, such as “Z-shell”, “C-shell”, or “Korn shell”. Sometimes, when using a system, the user may not be aware of the shell being used by the system.

This article will provide a detailed guide on various ways the type of shell can be checked on your system.

How to Check the Shell is in Use?

There are several ways to check the shell being used on their Linux system. This section will explain all of these methods.

Method 1: Check Process ID

The easiest method to check the current shell you are using is to use the process ID of that shell to check the name. Execute the following command in your terminal to check the type of shell in use:

$ ps -p $$
How to install Kali Linux in Window...

The name under the CMD section shows the shell currently being used as demonstrated above, which in this case is the bash shell.

Method 2: Use the echo “$SHELL” Command

This command utilizes the echo command to display the path of the “SHELL” variable on your terminal. The working of the command is shown below:

$ echo "$SHELL

Method 3: Use the echo $0 Command

The previous command was unable to display the name of the shell that is currently in use, but the echo $0 command performs that task by using the command shown below:

$ echo $0

Method 4: Use the “readlink /proc/$$/exe” Command

There exists an alternate command to the previous one which will be able to display the exact path of the shell. The command and its working are demonstrated below:

$ readlink /proc/$$/exe

That’s all from this guide!


There are several methods using which the name of the shell can be checked on your Linux operating system. The process ID can be used to check the name, or a few echo commands can also be used. This article has demonstrated all the possible methods to check which shell is used in Linux.