Showing posts with label Default shell of the logged in User in Solaris. Show all posts
Showing posts with label Default shell of the logged in User in Solaris. Show all posts

Thursday, September 27, 2012

How to find the default shell in UNIX or Linux or Solaris


Question: Default shell of the logged in User

Answer: There are many ways to find the default shell.

a)      By checking the last column in the /etc/passwd file  ( grep –i username /etc/passwd )

Eg:  [vjsujay@cheetah:/home/vjsujay]#grep -i vjsujay /etc/passwd
       vjsujay:x:48153:63002:Sujay-kumar:/home/vjsujay:/bin/ksh

b)      By displaying the value of global environment variable SHELL  ( echo $SHELL )

Eg: [vjsujay@cheetah:/home/vjsujay]#echo $SHELL
/bin/ksh

NOTE: This will give correct default shell name as output as long as your current shell is your default shell

c)      By using the command echo $0

Eg: [vjsujay@cheetah:/home/st39422]#echo $0
-ksh