whoami
displays the login name corresponding to the current
effective user
ID.
If you have used
su
to temporarily adopt another user,
whoami
will report the login name associated with that user
ID.
whoami
gets its information from the
geteuid
and
getpwuid
library routines respectively.
(See
getuid(2).)