In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to check the logged-in users under the Linux system". In the daily operation, I believe that many people have doubts about how to view the logged-in users under the Linux system. The editor has consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to check the logged-in users under the Linux system". Next, please follow the editor to study!
View the user's actions
If the system administrator wants to know the behavior of the user at a certain time, all he has to do is enter the command W and enter the following command in the SHELL terminal:
[ROOT@LOCALHOST ROOT] # W2:31PM UP 11 DAY, 21:18 4 USERS, LODE AVERAGE: 0.12,0.09, 0.08USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATROOT TTY1-09:21AM 3:23 0.13S 0.08S-BASHGEORGE TTY2-09:40AM 18pur00S 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 executing the W command and displaying the results.
Meaning of command information
The information shown above is as follows:
The first line displays the summary information of the system, and the fields represent the current time of the system, the running time of the system, the total number of users in the login yo and the average load information of the system. For several of the above forces, the significance of the data is:
2:13PM says the time to execute W is at 02:31 in the afternoon.
11DAYSpR81R18 indicates that the system has been running for 11 days, 21 hours and 18 minutes.
4 USERS indicates that the total number of login users of the current system is 4.
LOAD AVERAGE, together with the following numbers, indicates the load degree of the system in the past 10 minutes. The smaller the number, the lighter the system load.
A table is formed from the second row, with a total of eight columns showing what each user is doing and the system data occupied by the user.
USER: displays the login user account name. If the user logs in repeatedly, the account will also be repeated.
TTY: the terminal used by the user to log in.
FROM: shows where the user logs in to the system.
LOGIN@: means LOGIN AT and indicates the time when you log in and enter the system.
IDLE: the idle time of the user, the time of the meeting since the end of the user's last task.
JCPU: a terminal code that indicates the CPU time spent by all process tasks related to the terminal during the touch period.
PCPU: refers to the CPU time spent after the task of the WHAT domain is executed.
WHAT: represents the currently executed task.
View a user
When there are many users logging in to the system, you can add a user name after W, and you will check how the user performs the task.
(root@localost root) # w heiio2:31pm up 11 days,21:18 4 users, load average: 0.00,0.00, 0.00USER TTY FROM LOGIN@ 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 are only concerned with one aspect, you can use only the relevant options.
View login users
Similarly, if the system administrator wants to know who is logged in at some point, he can use the WEB command provided by the system, which can view the user who is currently logged in to the system and other information:
[ROOT@LOCAL 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, etc., and you can see whether the user is willing to accept other user information (- T) and display idle time (- I) and title bar (- H). If a user is willing to accept the information, a "+" will be displayed in the MESG column, which can also be used to send a slave message to the user using the command MESG.
View the history of logged in users
If the system administrator wants to know the historical behavior of the user logging in the system, he can also see that the user has logged in to the system. Use the LAST command to query the information of users who have logged in:
ROOT TTY1 09:21AM MON FRI 10 11:15 STILL LOGGED INGEORGE TYY2 09:40AM MON FRI 11 11:18-DOWNHELLO TTY6 11:12AM MON FRI 12 9:47-DOWNMARRY PTS/1 192.0.3.11 02:40PM FRI 17 12:56-DOWN... WTMP BEGINS FRI DEC 5 12:53:55 2003
When you use the LAST command, the contents of the files listed are too large to be seen at all. At this point, you can view it using the management methods described earlier, such as / LAST/ LESS, and you can view the content before and after. Just like looking at the situation of a user, if you want to check the login of a certain user, you can also add a user name after the LAST command, and the system will only show the login of that user.
[root@localhost root] # last georgegeorge tty2-09:40am mon fri 11 11.18-down. .Wtem begins fri dec 5 12 purl 53 Ten 55 2003
Executing the last command actually displays the contents of the wtmp file in the / var/log/ directory. Wtmp files are stored in binary format, such as
If you use a text editor to view it directly, you will see a pile of garbled code.
At this point, the study on "how to view logged-in users under the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.