View users: whoami and who am i distinguish tty1 and pts query process, etc.



    who am i shows the user name of the actual user, that is, the user
ID when the user logs in . This command is equivalent to who -m .     whoami   shows the effective user ID ( operating user ) .

 

    whoami displays the username of the current "operating user" (commonly used), while who am i displays the username of the "login user" .

 

    Just enter who (or w) to display all currently logged in users. The line that represents the login terminal.

 

 

     tty1 indicates that the login terminal is a virtual console (command line mode, black and white screen interface, just like cmd in Windows. Login through Linux's black and white ping, not through xshell login),through ALT+CTRL+Fn (n=1,2 ...,6). After logging in with tty1, when the crash occurs, you can switch to tty2 (alt+ctrl+f2). Use anotheruser to login, such as rootuser login, ps -aux | grep program_name to query the process that caused the system to crash just now, and then kill the pid . At this point, the system will return to normal, and the process can be started again through service program_name start.

 

pts/n (this n is theoretically unlimited), the user who logs in remotely (for example, I log in through xshell, xshell is a remote connection tool) , is the user who logs in using securecrt, putty, xshell and otherremote logintools, his terminal What is displayed is pts/n, for example, pts/0 means to log in to Linux remotely on the local machine . Under Windows, the open terminal is also displayed as pts/n.



 

 

In the above screenshot, there are two user logins, one is logged in through the native Linux login interface, and the other is remotely logged in to Linux on the local machine through xshell. As long as Linux is powered on, you can remotely connect to the virtual computer of the Linux operating system through the remote tool xshell.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326352393&siteId=291194637