Which shell am I using?

In this tutorial we will look at how to find out which shell is currently being used. Let's say that you just got shell access on an Ubuntu Linux box or some other box with a Linux distribution. The first thing you should want to know is what shell you are using. This is because different shells offer different features. You may well come to realise that if you are not using a shell that you are familiar with, you may be less productive.

To find out which shell you are currently using, type the following command:

echo $SHELL

The result of that command will tell you what your current shell is and may look something like:


That would mean that you are using the bash shell. On a side note, you would also realise that this shell resides in the bin directory.

Alternative way to find out which shell you are using

The above procedure should work, but in case it doesn't there is a sure fire way you can use to determine the current shell being used.

Run the following command in the shell:

ps -p $$

How this works is simple. The $ character will return the Process Identification Number (PID) of the current process and the current process in this case will always be your shell. Therefore, if you execute that command, you will be doing a process status listing on the current shell.

The result you receive after the command is executed gives you some information. This information happens to contain the name of the process. The name of the process is the name your shell.

Expect a result like:

  PID TTY          TIME CMD
16184 pts/1    00:00:00 bash

Under the CMD column, you will see the name of your shell you are using, in this case bash.

And that is all there is to finding out what shell you are using on Ubuntu or most major distributions of Linux. That is it for this tutorial, we hope you found it useful.

Thank Tutorial Arena for This Tutorial.
Show your appreciation with a +1...