UNIX/Linux: Finding Out Who is Logged In

The who command shows you:

  • Who is logged in
  • Where users are logged in

The who command has three forms.

who am i

Displays information only about the user logged in at the terminal where the command is entered. Use this command to determine your initial login name.

whoami

Examines the system file /etc/passwd and then displays the current user’s login name based on that file. Use this command after the su command to change your current user name. Remember to use who am i to determine who you really are.

who [options]

The who command examines the system file /var/run/utmp to obtain user information.