How to view the Logged-in user under Linux system

Source: Internet
Author: User
Tags current time

Although the introduction of user management, but that part mainly manages the user's account number, also is the static user list. Linux is a multiuser system that, once connected to a network, can serve multiple logged-in users at the same time. System administrators can keep abreast of the users in the system and what they are doing.

To view the actions of a user

If the system administrator wants to know the behavior of the user at a certain moment, just enter the command W, enter the following command in the shell terminal:

[Root@localhost ROOT] # W

2:31pm up one day, 21:18 4 USERS, Lode average:0.12, 0.09, 0.08

USER TTY from login@ 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 5.20S 0.09S 0.03S FTP

You can see the Execute w command and display the results.

Meaning of command information

The information shown above is indicated as follows:

The first line displays the summary information of the system, which indicates the current time of the system, the system running time, the total number of users in the login and the system average load information. For several of these forces, the meaning of the data is:

2:13PM indicates that the time of execution W is at 2:31 P.M..

11days,81:18 says the system runs 11 days, zero 21 hours and 18 minutes.

4 users indicate that the total number of user current system login is 4.

The load AVERAGE, along with the numbers that follow, indicates how much the system has been loaded in the past 1, 5, 10 minutes, and the smaller the number, the lighter the system load.

form the second line, a total of 8 columns showing what each user is doing and the system information that the user occupies.

User: Displays the username of the login account. Users repeat the login, the account will also appear repeatedly.

TTY: The terminal used by the user to log in.

From: Shows where users are logged on to the system.

login@: The meaning of login at, indicating the time when the login was entered into the system.

IDLE: User idle time, from the last task after the user, when the meeting.

JCPU: A terminal code to differentiate, indicating that in the touch of time, all related to the terminal process tasks of CPU time.

PCPU: Refers to the CPU time that is consumed by the task execution of the what domain.

WHAT: Represents the currently executing task.

View a user

When you log in to a lot of users of the system, you can add a user name after W, and you'll see how the user performs the task.

(root@localost root) #w heiio2:31pm up days,21:18

4 Users, Load average:0.00, 0.00, 0.00

USER TTY from login@ IDLE jcpu pcpu WHAT

Hello tty6 11:12am 34.00s 0.06s 0.06s Bash

By default, all of the above information is displayed, and you can use only the relevant options if you are concerned about only one aspect.

View Login Users

Similarly, if a system administrator wants to know who is logged in at a certain time, you can use the system-provided Web command to view the users and other information currently logged on to the system:

[Root@local ROOT] #who

Root tty1-09:21am

Reorge tty2-09:40am

Hello tty6-11:12am

Marry PTS/1:0 02:40pm

You can see that this information is very similar to the W command. If a user is willing to accept the information, a "+" is displayed in the MESG bar, which can also be used to send messages to the user using the command MESG.

View Login User History

If the system administrator wants to know the history behavior of the user landing in the system, also can inspect the user to have landed to the system. Use the last command to query for information that has been logged on to a user:

ROOT TTY1 09:21am MON FRI 11:15 still in

GEORGE TYY2 09:40am MON FRI 11:18-down

HELLO TTY6 11:12am MON FRI 9:47-down

MARRY pts/1 02:40pm FRI-12:56-down


WTMP begins FRI DEC 5 12:53:55 2003

When you use the last command, the contents of the file listed are so numerous that you cannot see clearly. You can view the contents before and after using the administrative methods described earlier, such as/last/less. Like viewing the user situation, want to see that a user's login, also can after the last command plus user name, then the system will only show the user login system.

[Root@localhost root]# last George

George tty2-09:40am Mon Fri 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. wtmp files are stored in binary format, such as

The fruit is viewed directly using a text editor, and you will see a bunch of garbled characters.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.