How to view logged-in users under Linux system

Source: Internet
Author: User

How to view logged-in users under Linux system


Although the previous introduction of user management, but that part of the main management user's account, but also a static list of users. Linux is a multi-user system that, once connected to the 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:


/table>
 
             
               [[EMAIL PROTECTED] ROOT] # W2:31PM UP 11 DAY ,21:18&NB Sp;4 users, lode average : 0.12, 0.09 , 0.08user tty from  [email protected] IDLE JCPU PCPU WHATROOT TTY1 - 09:21AM  3:23 0.13s 0.08s -bashgeorge tty2 - 09:40am 18:00s 0.12s 0.00s  telnethello tty6 - 11:12am 34.00s 0.06s 0.o6s bashmarry 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.


       
             
              
        ([email protected] Root) #w heiio2:31pm up one days,21:18 4 users, Load average:0.00, 0.00, 0.00USER TTY from [email prote CTED] IDLE jcpu PCPU whathello tty6 11: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:


       
             
              
        [[email protected] ROOT] #whoroot tty1-09:21amreorge tty2-09:40amhello tty6-11:12ammarry pts/1:0 02: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:


       
             
              
        ROOT TTY1 09:21am MON FRI 11:15 still logged ingeorge TYY2 09:40am Mon FRI one 11:18-downhello TTY6 11:12am Mon FRI 12 9:47-downmarry pts/1 192.0.3.11 02:40pm FRI-12:56-down ... WTMP begins FRI DEC 5 12:53:55 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.


       
             
              
        [Email protected] root]# last Georgegeorge tty2-09:40am mon Fri One 11.18-down.............wtem begins Fri Dec 5 12:53;55 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.


Source: >  


From for notes (Wiz)

How to view logged-in users under Linux system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.