Jump to content

whoami

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by RoadieRich (talk | contribs) at 18:29, 12 March 2019 (→‎See also: Missed some tt tags). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

whoami
Developer(s)Richard Mlynarik, Microsoft, ReactOS Contributors, Novell
Operating systemUnix, Unix-like, Microsoft Windows, ReactOS, NetWare
TypeCommand

In computing, whoami is a command found on most Unix-like operating systems, every Windows operating system since Windows Server 2003, and on ReactOS. It is a concatenation of the words "Who am I?" and prints the effective username of the current user when invoked.

Overview

The command has the same effect as the Unix command id -un. On Unix-like operating systems, the output of the command is slightly different from $USER because whoami outputs the username that the user is working under, whereas $USER outputs the username that was used to log in. For example, if the user logged in as John and su into root, whoami displays root and echo $USER displays John. This is because the su command does not invoke a login shell by default.

The earliest versions were created in 2.9 BSD as a convenience form for who am i, the Berkeley Unix who command's way of printing just the logged in user's identity.[1] The GNU version was written by Richard Mlynarik and is part of the GNU Core Utilities (coreutils).

The command is also available as part of the Windows 2000 Resource Kit[2] and Windows XP SP2 Support Tools.[3]

This command was also available as a NetWare-Command residing in the public-directory of the fileserver. It also outputs the current connections to which server the workstation is attached with which username.

Example

Unix, Unix-like

# whoami
root

Windows, ReactOS

C:\Users\admin>whoami
workgroup\admin

See also

References

External links