Basics

Linux whoami command

Print the username associated with the current effective user ID.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

whoami [OPTION]...

Examples

Print the effective user name.

whoami

Show which user an elevated command would run as.

sudo whoami

Parameters, options and clauses

Option / clauseDescription
--helpDisplay help and exit.
--versionDisplay version information and exit.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory