The WHO, W, and WhoAmI commands can display logged-in user names, but usage and usage effects vary, so let's look at the usage of these three commands and their differences.
1. Who command: Displays user information that is currently logged into the system and does not display the user's login via the SU command:
[email protected] ~]# who
Root Tty1 2015-08-19 16:23
Root pts/0 2015-08-27 01:08 (192.168.1.254)
Root PTS/1 2015-08-27 02:57 (192.168.1.254)
2, W command: The W command is also used to display the user information currently logged into the system, but the W command displays the information more detailed:
[Email protected] ~]# W
03:06:43 up 5:55, 3 users, Load average:0.00, 0.00, 0.00
USER TTY from [email protected] IDLE jcpu PCPU
Root tty1-19aug15 4:22 0.14s 0.14s-bash
Root pts/0 192.168.1.254 01:08 1:28m 0.06s 0.06s-bash
Root pts/1 192.168.1.254 02:57 0.00s 0.09s 0.04s W
3, WhoAmI command: Used to display their own user name, this command is equivalent to "id-un" instructions.
[Email protected] ~]# WhoAmI
Root
[Email protected] ~]# Id-un
Root
Let's take a look at some parameters of these three instructions
Parameters of the WHO command:
1, Who-b//Displays the date and time of the last restart
2. Who-r//Display the current runlevel of the initialization process
3. Add title for each column when who-h//display
4, WHO-M//display only the current running terminal information
5, WHO-Q//statistics on the number of currently logged in users
6. Who-l//Show Login process
7. Who-a//Show All information
Parameters of the W command
1, w-h//Do not display the title
2. W-u//After performing the SU command, the user name is ignored when the current process and CPU time are listed
3, W-s//use short mode. Logon time, JCPU, pcpu time are not displayed
This article is from the "Summer Month" blog, please make sure to keep this source http://lkc0110.blog.51cto.com/3410558/1687605
Linux commands by WHO, W, WhoAmI