Wednesday, January 28, 2009

How to find current shell in Ubuntu / Linux

There are several shells you can work on Linux, BASH (Bourne-Again SHell), CSH(C SHell), KSH (Korn SHell) are some of the famous ones.
So how you know what is your current SHELL?
try the following command in your terminal.
echo $SHELL

Find current working shell


  1. Thats actually not a good way to get a shell that your currently under, that only tells what default shell a new user is created with:

    asamuel@ardi002:~$ egrep ^SHELL /etc/default/useradd

    as a proof of concept, i use ZSH as my default shell, so thats the shell i am in. As you will see my shell environment variable still says /bin/sh.

    asamuel@ardi002:~$ echo $SHELL
    asamuel@ardi002:~$ getent passwd asamuel

  2. And even that still doesn't work 100% because, in my case, it says I'm using /usr/local/bin/tcsh

    That file is pointing to /bin/tcsh
    But /bin/tcsh *does not exist*

    (which is exactly the reason why I am searching an answer to what shell I am running :-/ )

  3. Brother Command to list the all shell please publushh

  4. ps -p $$

    The CMD variable will tell you what shell the command is executing as, and thus give you the shell you are actually using at that moment in the command line.