Summary of commands for querying the current user in Linux
1, w command to view the current user
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/91/A2/wKiom1j3IRrAwLzSAAA4v5ZfK70169.png-wh_500x0-wm_ 3-wmp_4-s_2657646646.png "title=" W.png "alt=" Wkiom1j3irrawlzsaaa4v5zfk70169.png-wh_50 "/>
[Email protected]/]# W
04:31:52 up 1:45, 2 users, load average:0.00, 0.01, 0.05
USER TTY from [email protected] IDLE jcpu PCPU
Root tty1 02:46 1:45m 0.02s 0.02s-bash
Root pts/0 192.168.146.1 03:19 0.00s 0.10s 0.02s W
The first line is: Current time, from boot to now how long, load balancing
The second line is: Description of each column
The third line is: root User login information
2. Who command to view the users on the host
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/91/A2/wKioL1j3I7SDzBQHAAAdlTqdYt0956.png-wh_500x0-wm_ 3-wmp_4-s_3933429255.png "style=" float:left; "title=" Who.png "alt=" Wkiol1j3i7sdzbqhaaadltqdyt0956.png-wh_50 "/>
[email protected]/]# who
Root Tty1 2017-04-19 02:46
Root pts/0 2017-04-19 03:19 (192.168.146.1)
"Attached": see who is currently logged on user
WHOAMI (no spaces between letters)
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/91/A2/wKioL1j3JQqBZVmiAAAKsK3UYMg466.png "title=" Whoami.png "alt=" Wkiol1j3jqqbzvmiaaaksk3uymg466.png "/>
3. Lastlog command to view the users on the host
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/91/A3/wKiom1j3JC-RfSUQAACPruqRJeA858.png "title=" Lastlog.png "alt=" Wkiom1j3jc-rfsuqaacpruqrjea858.png "/>
[Email protected]/]# Lastlog | Head-n 15
Username Port from Latest
Root pts/0 192.168.146.1 Wed Apr 19 03:19:47-0400 2017
Bin **never Logged in**
Daemon **never logged in**
ADM **never logged in**
LP **never logged in**
Sync **never logged in**
This article is from the "12300166" blog, please be sure to keep this source http://12310166.blog.51cto.com/12300166/1917455
Summary of query Current user commands in Linux hosts