Linux Command who am I, who, whoami

Source: Internet
Author: User


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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.