Kick off a user pkill-kill-t from a terminal connection pts/0
--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------
Use of W and who commands in Linux
Linux is a multi-user system that, once connected to a network, can serve multiple logged-in users at the same time. The system administrator can keep abreast of what users are doing in the system and what the user is doing.
View the actions of a user
If the system administrator wants to know the user's behavior at a certain moment, just enter the command W and enter the following command in the shell terminal:
Default
1234567 |
[root@LOCALHOST root] # W 2:31PM up 11 day ,21 :18 4 users, Lode average : 0.12, 0.09 , 0.08 USER TTY from login@ Span class= "crayon-e" >idle jcpu pcpu WHAT ROOT Tty1 - 09:21am 3 :23 0.13S 0.08s - bash GEORGE tty2 - 09:40am 18:00s 0.12s 0.00s telnet HELLO tty6 - 11:12am 34.00s 0.06s 0.o6s bash MARRY PTS/1 192.0.3.1102:40PM 5.20S 0.09s 0.03S FTP |
You can see the Execute w command and display the result.
Command message meaning
The information shown above is indicated as follows:
The first line shows the summary information of the system, the fields indicate the current time of the system, the system running time, the total number of users logged in and the system average load information. For several of these forces, the meaning of the data is:
2:13PM indicates that the time to execute W is 2:31 P.M..
11DAYS,81:18 indicates that the system is running for 11 days and 21 hours and 18 minutes.
4 users indicate that the total number of systems logged in today is 4.
The load AVERAGE, along with the numbers that follow, indicates how much the system has been loading in the last 1, 5, 10 minutes, the smaller the value, the lighter the system load.
Starting from the second line to form a table, a total of 8 columns, showing what each user is doing and the user's occupied system information.
User: Displays the login username. The user repeatedly logs in, the account will also appear repeatedly.
TTY: The terminal used by the user to log in.
From: Shows where the user landed the system.
[Email protected]: is the login at, indicating the time of landing into the system.
Idle: User idle time, from the end of the last task of the user, when the meeting is recorded.
JCPU: A terminal designator to differentiate, which indicates the CPU time spent on all process tasks associated with the terminal during the touch time period.
PCPU: Refers to the CPU time that is spent after the task of the what domain is executed.
What: Represents the currently executing task.
View a user
When the login system user is a lot of time, you can add a user name after W, you will see the user to perform the task of the situation.
Default
1234 |
〔root@localost root)#w heiio2:31pm up days,21:18 4 users, load average : 0.00, 0.00 , 0.00 USER TTY from login@ Span class= "crayon-e" >idle jcpu pcpu WHAT Hello tty6 :12am 34.00s 0.06s 0.06s bash |
By default, all of the above information is displayed, and if you only care about one aspect, you can use only the relevant options.
View Login User
Similarly, if a system administrator wants to know which users are logged on at a given moment, they can use the system-provided web commands, which can view the users and other information currently logged on to the system:
Default
12345 |
[root@LOCAL root]#who root tty1 -in :21am /c9> reorge tty2 -in :40am /c0> Hello tty6 -one :12am Marry pts/1 :0 :40pm |
You can see that the above information is very similar to the W command. If you want to make the list more detailed, you can add the option-hit, and so on, you can get the user is willing to accept other user information (-T) can also display the idle time (-i) and the title bar (-h). If a user is willing to accept the message, a "+" is displayed in the MESG column, which is also used to send the message to the user using the command MESG.
View Login User History
If the system administrator wants to know the historical behavior of user login in the system, it can also see that the user has logged in to the system. Use the last command to query the information of the user who logged in:
Default
123456 |
ROOT TTY1 :21AM MON FRI : still logged C16>in GEORGE tyy2 09:40AM mon fri 11 11:18 -down HELLO tty6 11:12AM mon fri 12 9:47 -down MARRY PTS/1 192.0.3.11 :40PM FRI 17< c14> : - down ... WTMP begins FRI DEC 5 : 2003 |
When you use the last command, the list of file contents can be very much, not clear at all. You can use the management method described earlier, such as/last/less, to view the front and back content. As with the view user situation, want to see that a user's landing situation, can also add a user name after the last command, the system will only show the user login system situation.
Default
1234 |
[root@localhost Span class= "crayon-v" >root]# last George George tty2 -in :40am Mon Fri 11.18 - down ....... . wtem begins Fri Dec 5 : 2003 |
Executing the last command is actually displaying the contents of the Wtmp file in the/var/log/directory. The wtmp file is stored in binary format, such as
The results are viewed directly using a text editor, which is a bunch of garbled characters.
Note: Linux kicks out the logged-in user's method :
Default
(pts/0 user terminal number as seen by W command)
Use of W and who commands in Linux