Whoami

From LQWiki
Jump to navigation Jump to search

The command whoami simply outputs the username of the currently logged in user. If your username is "foo", then, for example:

$ whoami
foo
$

The command is useful to remind you which user login you are currently using, say, if you are connecting to several machines or you are using su in order to use a different user's permissions (e.g. root). For this reason, most shell prompts have the capability of placing the username in the prompt (as well as the hostname), for example

foo@somehost $

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: and use its man page

Related Commands

All of these relate to user information.

  • id - dump UID and GID information.
  • logname - show the login name.
  • groups - show groups of the current user.
  • users - show who is logged in.
  • who - show who is logged in from where.

This article is a stub and needs to be finished. Plunge forward and help it grow!