View logged-on users and disconnected users in Centos

Source: Internet
Author: User
Tags centos

View the 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

Example

1. View login users

The code is as follows: Copy code

[Root @ linux tmp] # w
18:00:52 up 2 days, 1 user, load average: 0.00, 0.00, 0.00
User tty from login @ IDLE JCPU PCPU WHAT
Dekeha pts/3 121.12.149.106 46: 42 12.26 s 0.01 s-bash

2. Log out of the logged-on user

The code is as follows: Copy code

Pkill-kill-t pts/3

3. Check whether the user is logged out.

The code is as follows: Copy code

[Root @ linux tmp] # w
18:02:33 up 2 days, 0 users, load average: 0.00, 0.00, 0.00
User tty from login @ IDLE JCPU PCPU WHAT

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.