Home·Terminal commands

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

Q. What does whoami do?

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

Q. How do I type it?

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

Q. How 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