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
       

4 comments:

Unknown said...

thanx for the post. its very useful for basic knowledge.

Unknown said...

hi..fnds. can u plz post linux related information.

Unknown said...

Đơn vị vận chuyển gửi hàng từ việt nam sang Hoa Kỳ
Công ty vận chuyển gửi hàng từ việt nam sang Lôn-đôn chi phí rẻ
Đơn vị ship nhanh hàng hóa từ việt nam sang thái lan chi phí thấp

Patrick Co Eban said...


Networking Projects for Final Year CSE Students


The IEEE Network projects Networking Projects for Final Year CSE Students has direct impact on undergraduate and graduate student education and training. Final Year Engineering Students who are software developers can structure a project around building a network firewall application Final Year Project Centers in Chennai

JavaScript Training in Chennai

JavaScript Training in Chennai