System

whoami

Print the current effective username.

useridentityshellpermissions

Additional Notes

whoami prints the username your current shell is running as. It is useful when using sudo, containers, SSH sessions, or different accounts.

It shows effective user identity, which matters for permissions.

Syntax

whoami

Parameters

This command takes no options or parameters.

Examples

whoami

Print the current user.

sudo whoami

Usually prints root, showing the command is running with elevated privileges.

ssh server whoami

Check the remote login user.

Practical Notes

  • Use id for UID, GID, and group membership details.
  • Use logname if you need the original login name in some contexts.
  • In scripts, identity checks can prevent running dangerous actions as the wrong user.