In Linux, the WHO series commands exist who/whoami/who am I.
First of all, I have an ordinary user guixian001 system. Then execute the command whoami/who am i/who to execute the command separately. As follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/B9/wKioL1VRZYrjh8jCAACd9ikK2sU994.jpg "title=" Qq20150512102223.jpg "alt=" Wkiol1vrzyrjh8jcaacd9ikk2su994.jpg "/>
We then use the SU command to switch to the root user and execute the above three commands.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/B9/wKioL1VRZjujNeOxAACn1pFaJTU347.jpg "title=" Qq20150512102553.jpg "alt=" Wkiol1vrzjujneoxaacn1pfajtu347.jpg "/>
Do you see the difference? Use the WhoAmI command to display the user name of the current action user. The Who am I displays the user name of "logged in user". To explain this phenomenon, you need to introduce two concepts in Linux-the actual user (UID, the user ID) and the active user (Euid, the effective user ID).
The actual user is the user logged in with the user, so throughout the logon session, the actual user will not change. the active user is the user who is currently performing the operation, which can be switched arbitrarily using the SU and sudo commands. In general, the actual user and the effective user is the same, only when the user identity switch occurs, the difference occurs. So who am I shows the actual user's username, that is, the user ID when logged in, the equivalent of Who-m, and WhoAmI shows the valid user 's ID is euid.
References:
"Linux is the One"
"Who am I"-linux command five-minute series 16
Who series commands in Linux who/whoami/who am I