Linux Command who am I, who, whoami today is not talking about Jackie Chan's movie "who I am", but about Linux's who series commands, including who, whoami, and who am I. Www.2cto.com: [rocrocket @ rocrocket ~] $ Whoamirocrocket [rocrocket @ rocrocket ~] $ Who am irocrocket pts/3 (: 0.0) [rocrocket @ rocrocket ~] $ Whorocrocket: 0 09: 54 rocrocket pts/0 (: 0.0) rocrocket pts/1 (: 0.0) rocrocket pts/3 (: 0.0) after I replace sudo su (or sudo su-) with the root user, let's look at www.2cto.com [rocrocket @ rocrocket ~]. $ Sudo su [root @ rocrocket] # whoamiroot [root @ rocrocket] # who am irocrocket pts/3 (: 0.0) [root @ rocrocket] # whorocrocket: 0 09: 54 rocrocket pts/0 (: 0.0) rocrocket pts/1 (: 0.0) rocrocket pts/3 (: 0.0) see the difference, whoami displays the User Name of the current "Operation user", while who am I displays the user name of "Login User. The Linux term is as follows: (actual user = uid, that is, user id. Valid user = euid, I .e. valid user id) who am I displays the actual user name, that is, the user id when the user logs on. This command is equivalent to who-m. Whoami displays the valid user ID. www.2cto.com. After understanding the difference between the two, let's talk about the who command. Someone may ask, why is it not displayed in who after I su sudo to root? This is because su's previous user process space exists as a sub-space and does not get a login tty. The who command focuses on checking which users have logged on to this machine. The role of who-m is the same as that of who am I. Who-q is used to display the number of currently logged-on users. If you think the output information of who is obscure, you can use who-H to output the information, so that you can add the column name to each column for reading.