wer bin ich

from Wikipedia, the free encyclopedia

whoami is a Unix command that outputs the username of the user calling the command. The term is derived from the English question Who am I? (in German “Who am I?”). Especially with multi-user systems such as Unix and related derivatives , users are able to change their identity, for example with the Unix command suor sudo . Especially with older shells that did not include the user name in the prompt, the user could find out suwhich user name he was currently working under after just a few confusions. A short call of the whoamicommand is enough to be sure of your identity.

whoamiis part of the GNU Core Utilities ; the version was written by Richard Mlynarik for the GNU project .

Use under Unix

Modern Unix shells set the environment variable when logging on , which is usually also output in the command line prompt. However, this contains the user name that belongs to the effective UID and not the real one. If you call without parameters, for example, only the real UID changes, but not the effective one. This can lead to confusion: $USERsu

benutzer@host $ whoami
benutzer
benutzer@host $ su
Password:
benutzer@host $ whoami
root
benutzer@host $ exit
benutzer@host $ whoami
benutzer

Calling suwith the parameter also -changes the effective UID, because a new login shell is started (and the value of the environment variable $USERis therefore also different). Calling is generally whoamisuperfluous here because the real username is then already in the prompt:

benutzer@host $ whoami
benutzer
benutzer@host $ su -
Password:
root@host $ whoami
root
root@host $ logout
benutzer@host $

Alternatives

The Unix command idthat outputs -unthe same output when called with the parameters whoamiis whoaminow obsolete.

whoami on other platforms

Programs with the same name and an analogous range of functions were also created for other (multi-user) operating systems.

Novell NetWare

Also, Novell NetWare , the "Who am I" function. For DOS -based clients there is whoami.exe :

Z:\>WHOAMI.EXE
You are user ZDL attached to server S311, connection 4.
Server S311 is running NetWare v3.12 (25 user).
Login time: Saturday November 22, 2008  2:53 pm

Microsoft Windows

The Windows 2000 Resource Kit , Windows Vista , Windows 7 and Windows Server 2008 all have the Whoami.exe program , which provides a similar functionality. Various information, e.g. B. Logon-ID, UPN or FQDN as well as lists of users, groups and authorizations can be determined in various formats (e.g. CSV ).

PS C:\> whoami /FQDN
CN=Mustermann\, Max,OU=Users,OU=4711,OU=42,OU=wikipedia,DC=de,DC=wikipedia,DC=org
PS C:\> whoami /USER /FO CSV
"Benutzername","SID"
"wikipedia\Mustermann","S-1-5-21-123456789-1234567890-1234567890-12345"

MorphOS

WhoAmI as part of AmiTCP

Ram Disk:> whoami
morphosuser

Web links

Individual evidence

  1. id  -  Open Group Base Specification