whoami — Display the Effective Current User Name

Synopsis

/usr/ucb/whoami 

Description

whoami displays the login name corresponding to the current effective user ID. If you have used su to temporarily adopt another user identity, whoami reports the login name associated with that user ID. whoami gets its information from the geteuid and getpwuid library routines (see getuid(2) and getpwnam(3C)).

Examples

The following examples show the current effective user ID. Because root does not have /usr/ucbt in the search path, the full path name is required to execute the command as root.

castle% whoami 
winsor 
castle% su 
# whoami 
whoami: not found 
# /usr/ucb/whoami 
root 
# exit 
castle% su ray 
castle% whoami 
ray 
castle% 

Files

/etc/passwd User name ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.