Blog | Tech Blog | Secure Coding | Twitter | RSS Feed | Get Email Updates


----

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.):


CODE:
  1. echo $SHELL

Output on my system:

CODE:
  1. /bin/bash

Command:

CODE:
  1. echo $0

Output on my system:

CODE:
  1. bash

Command:

CODE:
  1. ps -p $$

Output on my system:

CODE:
  1. 7772 pts/0    00:00:00 bash

© Shantanu Goel | Tip: Commands To Find Out The Shell You Are Using

Custom Search
Liked this post? Get FREE Updates
Subscribe to RSS feed
Or
Enter Your E-mail ID below

Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Facebook
  • Reddit
  • Print this article!

Related posts