Three ways to view information about logged-in System users
Yun Zhengjie
Copyright Notice: Original works, declined reprint! Otherwise, the legal liability will be investigated.
I. Who this command shows who can log in, but this has a lot of fancy gameplay, this command is super simple
Syntax: Who [OPTION] ... [FILE | ARG1 ARG2]
1. Parameters:-U, display idle time, if the user has any action in the previous minute, will be marked as "." If the user has not had any action for more than 24 hours, the "old" string is marked.
For example:
2. Parameter:-m, the effect of this parameter is the same as specifying the "Am I" string. The current login user and the IP of the login terminal are displayed.
For example:
3. Parameters:-Q or--count, only display the login system's account name and total number of people.
For example:
4. Parameters:-H or--heading, display the header information column for each field.
For example:
5. Parameters:-b,--boot Last system boot time
For example:
6. Parameters:-D,--dead Print to exit login information
For example:
7. Parameters:-L,--Login Print System Login process
For example:
8. Parameters:-R,--runlevel print the current operating level of the system
For example:
9.-s,--short only print name, use terminal, and time "default"
10 Parameters:-A,--all equivalent to-b-d--login-p-r-t-t-u
For example:
Two. W This command can show who logged in and what they are doing.
Syntax: W-[HUSFV] [user]
1. Parameter:-F turns on or off to show where the user is logged into the system. By default, it is turned off to show where users are logged into the system.
For example:
2. Parameter:-H does not display the header information column for each field.
For example:
3. Parameter:-L uses a detailed format list, which is a preset value.
4. Parameter:-S, using a concise format list, does not display the user login time, terminal stage jobs and program CPU time spent.
For example:
5. Parameter:-v displays version information.
For example:
Three. Last command to list information about the user who is currently logged in to the system
The command output field describes:
First column: User name
Second column: End position. pts/0 (pseudo terminal) means a remote connection from a user such as SSH or Telnet. TTY (teletypewriter) means a user connected directly to a computer or locally connected
Third column: Login IP or kernel. If you see: 0.0 or nothing, this means that the user is connected via a local terminal. In addition to restarting the activity, the kernel version is displayed in the status.
Fourth column: Start time
Fifth column: End time (still login in has not exited down until normal shutdown crash until shutdown is forced)
Sixth column: Duration
1. Parameter:-A, the host name or IP address that will be logged into the system, displayed in the last line
For example:
2. Parameter:-d, convert IP address to host name
3. Parameters:-F, record the last modification time of the file, specify the record file, the default is to display the Wtmp file in the/var/log directory record, but/var/log directory btmp can display richer content, can display remote login, such as SSH login, including failed login requests.
For example:
Create a file First:
When we created it, we looked at the generation time of this file.
And then we write the new content to the file in a second.
Review the file modification time again
4. Parameter:-I, which shows the situation of a specific IP login. Track the case of a specific IP login with-i display. Tracking with
5. Parameters:-O, I understand is the system of survival time, if there is any Miss elder sister has other ideas, you can leave a message yo ~ (man help explanation: Read an old-type wtmp file (written by LINUX-LIBC5 applications). )
For example:
6. Parameters:-N, followed by numbers, sets the number of displayed columns for the list
For example:
7. Parameters:-W, display all users and domain names in the output
For example:
8. Parameter:-R, does not display the host name or IP of the login system (omit hostname field)
For example:
9. Parameter:-T, display the information before YYYYMMDDHHMMSS
For example:
10. Parameters:-X, which shows the history of system shutdown, user login, and exit (this is the default parameter, if no parameter is added)
Three ways to view information about logged-in System users