How to view all users and kick out centos

Source: Internet
Author: User
View the users in the system: cut-d:-f1/etc/passwd to view the users who can log on to the system: cat/etc/passwd | grep-v/sbin/nologin | cut-d:-f1 view user operation: w command (root permission required) view a User: w user name view login user: who View user logon history: last View user operations View which users in the system: cut-d:-f 1/etc/passwd
View users who can log on to the system: cat/etc/passwd | grep-v/sbin/nologin | cut-d:-f 1
View user operations: w command (root permission required)
View a User: w user name
View logon User: who
View user logon history: last
View the user's OS administrator to know the user's behavior at a certain time point, just enter the command W (w in lower case of CentOS), and enter the following command in the SHELL terminal: you can see that the command W is executed and the result is displayed. Command Information meaning the preceding information is shown as follows: the first line displays the summary information of the system, the fields indicate the current system time, system running time, total number of users logged on to the system, and average system load. For the preceding data display, 15:59:27 indicates the execution time of W. Up indicates the system running time. 4 USERS indicates the total number of USERS logged on to the current system. Together with the subsequent numbers, the load average indicates the system LOAD in the past 1, 5, and 10 minutes. The smaller the value, the lighter the system LOAD. A table is formed from the second row. There are 8 columns that show what each user is doing and the system information occupied by the user. USER: displays the login USER account name. The user logs in again, and the account will appear again. TTY: the terminal used for user login. FROM: displays where the user logs on to the system. LOGIN @: indicates the time when LOGIN is logged on to the system. IDLE: the user's free time, from the user's last task after the end of the meeting notes. JCPU: indicates the CPU time consumed by all process tasks related to the terminal within the touch period. PCPU: the CPU time consumed by tasks in WHAT domains after execution. WHAT: Indicates the current task. View a user. when many users log on to the system, you can add a user name after W to view the task execution status of the user. By default, the system displays all the above information. if you only care about one aspect, you can only use the relevant options. View login users
Similarly, if the system administrator wants to know the users logging on to the system at a specific time, he can use the who command provided by the system. this command can view the users currently logged on to the system and other information: the preceding 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 to get whether the user is willing to accept other user information (-T) and display the idle time (-I) and the title bar (-H ). If a user is willing to accept the information, a "+" is displayed in the MESG column. you can also use the MESG command to send the information to the user. View the logon user history. if you want to know the historical logon behavior of a user in the system, you can also view the user's previous logon to the system. You can use the LAST command to query the information of logged-on users. when you use the LAST command, a large number of files are listed and cannot be seen clearly. In this case, you can use the management method described earlier to view the content, such as/LAST/LESS. To view the login status of a user, you can add the user name after the LAST command. The system only displays the user's login status. Execute the last command to display the content of the wtmp file in the/var/log/directory. Wtmp files are stored in binary format. if you use a text editor to view them directly, a bunch of garbled characters are displayed. How to KILL the logged-in user in CentOS # pkill-KILL-t pts/0 (pts/0 is the user terminal number displayed in w command)
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.