The Linux w command is used to display the information of the user currently logged in to the system.
Execute this command to know who is currently logged in to the system and the process they are executing.
Executing the w command alone will display all users. You can also specify a user name to display only the relevant information of a certain user.
- -f Turn on or off the display of where the user logs in to the system.
- -h Do not display the title information row of each column.
- -l Use detailed format list, this is the default value.
- -s uses a concise format list, does not display the user login time, the CPU time consumed by terminal stage operations and programs.
- -u Ignore the name of the executing program and the information that the program consumes CPU time.
- -V Display version information.
[[email protected] test]# w
10:35:02 up 134 days, 10:52, 2 users, load average: 0.01, 0.06, 0.06
USER TTY FROM FROM [email protected] IDLE JCPU PCPU WHAT
root tty1 tty1 bash. FROM 226 month 17 134days 6.00 s. 0 226 134days. 0 0 226 109 s. p>
The meaning of the command information The information displayed above is as follows:
The first line shows the summary information of the system, and the fields respectively indicate the current time of the system | boot Duration | Total number of users logged into the system | System average load information (1/5/10 minutes). The meaning of the field shown in the figure above is:
10:35:02 means that the time to execute w is 10:35:02 in the morning.
up 134 days, 10:52 means the system runs for 134 days, 10 hours and 52 minutes.
users means that the total number of login users in the current system is 2.
Load average and the following numbers together indicate the load level of the system in the past 1, 5, and 10 minutes. The smaller the value, the lighter the system load.
Starting from the second line, a log-in user information list is formed. There are 8 columns in total, which respectively display what each user is doing and the system resources occupied by the user.
User | Terminal | Source | Login Time | Idle Time | Use Time | Current Process | In Progress
USER: Display the login user account name. If the user logs in repeatedly, the account will appear repeatedly.
TTY: The terminal used by the user to log in.
FROM: Shows where the user logs in to the system.
[email protected]: It means LOGIN AT, which means the time to log in and enter the system.
IDLE: The user’s idle time, starting from the end of the user’s last task.
JCPU: distinguished by terminal code, which means the CPU time consumed by all process tasks related to the terminal during this period of time.
PCPU: Refers to the CPU time consumed after tasks in the WHAT domain are executed.
WHAT: Represents the currently executing task.