How to determine which unix shell I am using?

Is there a simple way by which I can determine what type of unix shell I am in ie, am I in bash / csh / ksh / tcsh ?

+73
linux unix shell
Jul 28 '10 at 1:58
source share
5 answers

Try:

 echo $0 

This often works in different shells.

+117
Jul 28 '10 at 2:10
source share
 mac:~$ ps PID TTY TIME CMD 223 ttys000 0:00.33 -bash obsd:~$ ps PID TT STAT TIME COMMAND 20038 p0 Ss 0:00.01 -ksh (ksh) 22251 p0 R+ 0:00.00 ps 

Or just echo $SHELL

+19
Jul 28 '10 at 2:01
source share

The echo $SHELL command will give you the name of your shell relative to root.

+10
Mar 20 '13 at 4:16
source share

Each wrapper I know sets $ variable ($$) in its pid. So that...

 ps | grep $$ 
+7
Aug 03 '10 at 18:14
source share

If you use an OSx terminal, then the shell is indicated in the terminal title bar when it starts - for example: Terminal - ShellName - 80x24

+5
Dec 01 '11 at 19:15
source share



All Articles