~couchNerd ~serialOutrager ~puts2In42 ~makesPigsFly

Tip: Commands To Find Out The Shell You Are Using

· by Shantanu Goel · Read in about 1 min · (117 Words)
bash commands Linux shell ssh

Many times you might not be sure about which shell you are currently using. Especially if you are not on your system and logging into someone else’s, or maybe ssh’ing into a remote server. Worry not, because here are few simple commands that you can use to find out which shell you are using currently.

Command (Note: This one is a bit unreliable as it might not work with non-bash shells or on redirection. Pls check the comments for details. Thanks to Shantanu Kumar and renoX for pointing this out.):

echo $SHELL

Output on my system:

/bin/bash

Command:

echo $0

Output on my system:

bash

Command:

ps -p $$

Output on my system:

7772 pts/0 00:00:00 bash

Comments