Online Linux Terminal Logo
OnlineLinuxTerminal
System & ProcessesCLI Reference

$whoami

Print the effective username associated with the current shell session.

Syntax DefinitionPOSIX standard
whoami [OPTIONS]
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `whoami` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

Overview & How whoami Works

`whoami` outputs the username of the currently logged-in effective user. It is widely used in shell scripts to verify whether execution is running under root or an unprivileged service account.

Common Flags & Command Options

Flag / OptionDescription
--helpDisplay help summary and exit.
--versionOutput version information and exit.

Practical Real-World Examples

Example #1Check active user identity

Prints current session username.

Sample Output:
user

Frequently Asked Questions

How is whoami different from the id command?

`whoami` prints only the username string, whereas `id` prints the numeric UID, primary GID, and all secondary groups.