A
WhoAmI is a fairly simple command.
Two
"Who": Print who's currently logged in
============================================
The ' Who ' prints information is about the users who is currently logged on.
Synopsis:
' Who ' [OPTION] [FILE] [Am I]
If given no non-option arguments, ' who ' prints the following
Information for each user currently logged On:login name, terminal
Line, login time, and remote hostname or X display.
If given one non-option argument, ' who ' uses that instead of a
Default system-maintained file (often '/var/run/utmp ' or '/etc/utmp ')
As the name of the file containing the record of the users logged on.
'/var/log/wtmp ' is commonly given as a argument to ' who '
Who had previously logged on.
If given-non-option arguments, ' who ' prints only the entry for
The user running it (determined from their standard input), preceded by
The hostname. Traditionally, the arguments given is ' Am I ', as in
' Who am I '.
Time stamps is listed according to the time zone rules specified by
The ' TZ ' environment variable, or by the system default rules if ' TZ '
is not set. *note specifying the time Zone with ' TZ ': (LIBC) TZ
Variable.
#记住用户的概念非常广泛, not only the actual user, but also a variety of special users, the general ID is 0 ~ 500
#参考/etc/passwd file to gain a deeper understanding of the user's concept.
The program accepts the following options. Also See *note Common
Options::.
I.
****************************************************************************************
'-A '
'--all '
Same as '-b-d--login-p-r-t-t-u '.
*************************************************************************************
'-B '
'--boot '
Print the date and time of last system boot. #最后一次系统启动的时间
The first line shown #who-A
**************************************************************************************
'-R '
'--runlevel '
Print the current (and maybe previous) Run-level of the Init
Process.
The second line shown #who-A, run level
****************************************************************************************
'-l '
'--login '
List only entries this correspond to processes via which the
System is waiting-a user to login. The user name is always
' LOGIN '.
#who the first six lines of the body, waiting for the user port to log on
************************************************************************************************
'-U '
After the login time, print the number of hours and minutes.
The user has been idle. '. ' means the user was active in the last
Minute. ' Old ' means the user have been idle for more than hours.
#正文who-A logged in user, give "login Address" "Login Time" and some other data
*************************************************************************************
'-W '
'-t '
'--MESG '
'--message '
'--writable '
After each login name print a character indicating the user ' s
Message Status:
' + ' allowing ' write ' messages
'-' disallowing ' write ' messages
'? ' Cannot find terminal device
#显示是否可以用write命令去发送信息
***************************************************************************************
'-H '
'--heading '
Print a line of column headings.
#这是个比较好的辅助命令 to improve readability of display results
************************************************************************************
Ii
Some other parameters
1. Display dead processes and active processes
'-d '
'--dead '
Print information corresponding to dead processes.
'-P '
'--process '
List active processes spawned by Init.
'-P '
'--process '
List active processes spawned by Init.
2. Slightly detailed results than WhoAmI
'-M '
Same as ' Who am I '.
3. Display the total number of users logged in
'-Q '
'--count '
Print only the login names and the number of users logged on.
Overrides all other options.
4. Other
'--lookup '
Attempt to canonicalize Hostnames found in utmp through a DNS
Lookup. This isn't the default because it can cause significant
Delays on systems with automatic dial-up Internet access.
'-S '
ignored; For compatibility and other versions of the ' Who '.
'-t '
'--time '
Print last system clock change.
An exit status of zero indicates success, and a nonzero value
Indicates failure.
Linux--Who WhoAmI