What is the *nix command to view a user's default login shell

The canonical way to query the /etc/passwd file for this information is with getent. You can parse getent output with standard tools such as cut to extract the user's login shell. For example:

$ getent passwd $LOGNAME | cut -d: -f7
/bin/bash

The command is finger.

[ken@hero ~]$ finger ken
Login: ken                      Name: Kenneth Berland
Directory: /home/ken                    Shell: /bin/tcsh
On since Fri Jun 15 16:11 (PDT) on pts/0 from 70.35.47.130
   1 hour 59 minutes idle
On since Fri Jun 15 18:17 (PDT) on pts/2 from 70.35.47.130
New mail received Fri Jun 15 18:16 2012 (PDT)
     Unread since Fri Jun 15 17:05 2012 (PDT)
No Plan.

The login shell is defined in /etc/passwd. So you can do:

grep username /etc/passwd

Tags:

Linux

Unix

Shell