Home·Terminal commands
Ad

Claim your crypto exchange bonus

Bonuses you get just for signing up. Terms are copied straight from each exchange.

whoami

Permissions

Usage

whoami

Prints the effective user name rather than the one you logged in as, so inside sudo or su it says root.

Common flags

FlagMeaning
nonewhoami takes no options; it is the same as id -un

Examples

whoami

The effective user name.

sudo whoami

Prints root, which is how you check sudo works.

Numeric and symbolic modes name the same thing: 755 and u=rwx,go=rx are the same permission.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

QWhat does whoami do?

Prints the effective user name rather than the one you logged in as, so inside sudo or su it says root.

QHow do I type it?

whoami — square brackets mark the parts you can leave out.

QHow many flags are worth knowing?

1 are listed here; the full set is in man whoami. This command sits under Permissions.

Related commands

man page: man whoami