home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 1.8 There Are Many Shells Chapter 1
Introduction
Next: 1.10 Internal and External Commands
 

1.9 Which Shell Am I Running?

You can usually tell which family your shell belongs to by a character in the prompt it displays. Bourne-type shells usually have $ in the prompt. The C shell uses % . (But tcsh users often use > .)

It's possible to customize the prompt ( 7.1 ) so that it displays additional information, but most users and system administrators will keep the convention of ending the prompt with the original prompt character.

To be certain, type one of these commands (the second is for systems that use NIS, Sun's Network Information Service, to manage network-wide files):

% 

grep 

yourloginname 

/etc/passwd


% 

ypcat passwd | grep 

yourloginname



You should get back the contents of your entry in the system password file. [2] For example:

[2] That may match more than one entry. Searching for tim could also find a user named timothy or fatima . A more accurate regular expression ( 26.1 ) is '^ yourloginname :' .

tim::23:10:Tim O'Reilly:/home/tim:/bin/csh

The fields are separated by colons. The last field should show the shell you are using. /bin/csh (or /usr/bin/csh ) is the C shell, /bin/sh is the Bourne shell (or Korn shell), and so forth. An empty last field defaults to the Bourne shell.

In case you're interested in the rest of the line, the first field shows your login name. The second stores your encrypted password, if any; this may be kept in a separate "shadow password" file. The third and fourth fields show your user ID or UID ( 38.3 ) and group ID or GID ( 38.3 ) , respectively. The fifth field often contains information about you, and the sixth your home directory.

- TOR


Previous: 1.8 There Are Many Shells UNIX Power Tools Next: 1.10 Internal and External Commands
1.8 There Are Many Shells Book Index 1.10 Internal and External Commands

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System