The man page description of who
command is
who - show who is logged on
But there exists a similar command whoami
. The man page description of whoami
is
whoami - print effective userid
Can anyone explain what exactly these commands do ? How are they different from each other ?
Best Answer
I am logging in as root in my shell and typing
who
and this is the output.It effectively shows all the users that have established a connection.
Running
who
again will result in another entry for the user ramesh.Inside the
root
shell, I just dosu ramesh
and then runwhoami
. It will give me the current user, ramesh, as the output.Effectively,
who
gives the list of all users currently logged in on the machine and withwhoami
you can know the current user who is in the shell.