Previous Table of Contents Next


Module 160
whoami (BSD)

DESCRIPTION

The external whoami command displays the current effective user name of the terminal session on the tty. It displays who you are logged in as or who is logged in on the terminal in front of you.

The difference between whoami and who am i is whoami displays the correct information even if you have su'd. While who am i does not work because if user /etc/utmp. Actually, who am i displays your real user name and whoami displays your effective user name.

COMMAND FORMAT

The format of the whoami command follows.

     whoami

RELATED COMMANDS

Refer to the who command described in Module 159.

RELATED FILES

The whoami command uses the /etc/passwd file for user information.

APPLICATIONS

You can use the whoami command to display who you are logged in as even if you have su'd to a new user name. You may want to check your user name before creating files; the whoami command assures you on who you think you are or are not.

TYPICAL OPERATION

If this activity you use the whoami command to display who you are logged in as on the system. Begin at the shell prompt.

1.  Type whoami and press Return. One line of output is displayed on your screen. It tells you who is currently logged in on the system at the terminal in front of you.
2.  Turn to Module 150 to continue the learning sequence.


Previous Table of Contents Next