[How To] Find the current working shell

Sometimes working from command line might require to know which shell you are currently using. To find out the current working shell, below steps will be helpful:

Try below command first:

ps -p $$

Output:

PID TTY          TIME CMD
 2248 pts/8    00:00:00 bash

Another command which also works on MAC OS and other Linux distributions:

echo $0

Output:

-bash

The above commands work on RHEL, CentOS, Ubuntu, Fedora, Mac OS and Debian.

Share on Facebook2
Share on Google+1Tweet about this on TwitterShare on StumbleUpon1Share on LinkedIn0Share on Tumblr0Digg thisPin on Pinterest0Share on Reddit0Email this to someonePrint this page

About Abhijit Sandhan

Abhijit Sandhan
Loves Linux, Blogging, Traveling, Hiking and sharing knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA