{{Short description|Command on various operating systems}} {{lowercase title}} {{distinguish|Whoami (Mr. Robot)|}} {{Other uses|Who Am I? (disambiguation)}} {{Infobox software | name = whoami | logo = | screenshot = Whoami screenshot.png | screenshot size = | caption = coreutils <code>whoami</code> command | developer = Bill Joy, Richard Mlynarik, Intel, Microsoft, ReactOS Contributors, Novell | released = | latest release version = | latest release date = | operating system = Unix, Unix-like, iRMX 86, Windows, ReactOS, NetWare | platform = Cross-platform | genre = Command | license = BSD: BSD License<br />coreutils: GPLv3<br/>iRMX 86, Windows, NetWare: Proprietary commercial software<br /> ReactOS: GPLv2 | website = }} In computing, {{kbd|'''whoami'''}} is a command found on most Unix-like operating systems, Intel iRMX 86, every Microsoft Windows<ref>{{Cite web |url=http://technet2.microsoft.com/windowsserver/en/library/fc7edb8c-0e13-4d95-bb29-ad7464dac7071033.mspx?mfr=true |title=Microsoft TechNet Whoami article |access-date=2008-04-22 |archive-date=2008-05-04 |archive-url=https://web.archive.org/web/20080504001425/http://technet2.microsoft.com/windowsserver/en/library/fc7edb8c-0e13-4d95-bb29-ad7464dac7071033.mspx?mfr=true |url-status=dead }}</ref> 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== [[File:ReactOS-0.4.13 whoami command 667x434.png|thumb|The ReactOS <code>whoami</code> command]] The command has the same effect as the Unix command {{kbd|id -un}}. On Unix-like operating systems, the output of the command is slightly different from {{var|$USER}} because {{kbd|whoami}} outputs the username that the user is working under, whereas {{var|$USER}} outputs the username that was used to log in. For example, if the user logged in as ''John'' and {{kbd|su}} into ''root'', {{kbd|whoami}} displays {{samp|root}} and {{kbd|echo $USER}} displays {{samp|John}}. This is because the {{kbd|su}} command does not invoke a login shell by default.
The earliest versions were created in 2.9 BSD as a convenience form for {{kbd|who am i}}, the Berkeley Unix {{kbd|who}} command's way of printing just the logged in user's identity. This version was developed by Bill Joy.<ref>[https://www.freebsd.org/cgi/man.cgi?query=whoami&apropos=0&sektion=0&manpath=2.9.1+BSD&arch=default&format=html 2.9.1BSD Manual Page]</ref>
The GNU version was written by Richard Mlynarik and is part of the GNU Core Utilities (coreutils).
The command is available as a separate package for Microsoft Windows as part of the GnuWin32 project<ref>[https://gnuwin32.sourceforge.net/packages/coreutils.htm CoreUtils for Windows]</ref> and the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.<ref>[https://unxutils.sourceforge.net/ Native Win32 ports of some GNU utilities]</ref>
On Intel iRMX 86 this command lists the currents user's identification and access rights.<ref>[https://archive.org/details/bitsavers_inteliRMX1_19819263 iRMX™86 INTRODUCTION AND OPERATOR'S REFERENCE MANUAL For Release 6]</ref>
The command is also available as part of the Windows 2000 Resource Kit<ref>[http://www.microsoft.com/downloads/details.aspx?familyid=3E89879D-6C0B-4F92-96C4-1016C187D429&displaylang=en Windows 2000 Resource Kit Tool: Whoami.exe]</ref> and Windows XP SP2 Support Tools.<ref>[http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en Windows XP Service Pack 2 Support Tools]</ref>
The ReactOS version was developed by Ismael Ferreras Morezuelas and is licensed under the GPLv2.<ref>{{Cite web|url=https://github.com/reactos/reactos/blob/master/base/applications/cmdutils/whoami/whoami.c|title = Reactos/Reactos|website = GitHub|date = 3 January 2022}}</ref>
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=== <syntaxhighlight lang=console> # whoami root </syntaxhighlight>
===Intel iRMX 86=== <syntaxhighlight lang=console> --WHOAMI USER ID: 5 ACCESS ID'S: 5, WORLD </syntaxhighlight>
===Windows, ReactOS=== <syntaxhighlight lang=doscon> C:\Users\admin>whoami workgroup\admin </syntaxhighlight>
==See also== {{Portal|Free and open-source software}} * {{kbd|logname}} * {{kbd|id}} * {{kbd|who}} * User identifiers for Unix * List of Unix commands
==References== {{Reflist}}
==Further reading== * {{cite book | first = Daniel J. | last = Barrett | year = 2012 | title = Macintosh Terminal Pocket Guide: Take Command of Your Mac | publisher = O'Reilly | isbn = 978-1449328986}} * {{cite book | first = William R. | last = Stanek | year = 2008 | title = Windows Command-Line Administrator's Pocket Consultant, 2nd Edition | publisher = Microsoft Press | isbn = 978-0735622623}}
==External links== {{Wikibooks|Guide to Windows Commands}} * {{man|1|whoami|4.2BSD}} * {{man|1|whoami|FreeBSD}} * [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/whoami whoami | Microsoft Docs]
{{Unix commands}} {{Core Utilities commands}} {{Windows commands}}
Category:Unix user management and support-related utilities Category:ReactOS commands Category:Windows administration