Linux View current logged-in user and kick out user __linux

Source: Internet
Author: User
Tags pkill

1, view the current logged-in user

[WILSH@LCL ~]$ Whatis w
(1)-show The Who are logged on and what they are doing
[WILSH@LCL ~]$ W
 09:49:30 up 1 day, 17:19,  4 users,  load average:0.00, 0.00, 0.00
USER     TTY      from              login@   IDLE   Jcpu   pcpu WHAT
root     tty3     -                09:25   23:25   0.10s  0.08s-bash
root     pts/0    192.168.105.188  09:32    9:38   0.02s  0.02s-bash
root     pts/1    192.168.105.188  09:36    9:32   0.03s  0.02s-bash
wilsh    pts/2 192.168.105.188  09:41    0.00s  0.00s  0.00s W

2, kicking out the current online users

A) Pkill

[WILSH@LCL ~]$ Whatis pkill
pkill [Pgrep]        (1)-look up or signal processes, based on name and other  Attribu Tes
[WILSH@LCL ~]$ pkill-kill-u wilsh #-u is used to specify the user name
[WILSH@LCL ~]$ pkill-9-u wilsh #-kill-9 is OK.
[WILSH@LCL ~]$ pkill-kill-t pts/2
[WILSH@LCL ~]$ pkill-kill-t/DEV/PTS/2 # This is a wrong notation. Because it is clearly stated in the man page, if you want to use the-t parameter, you cannot bring the/dev/prefix. <span style= "color: #FF99FF;" ><span style= "Background-color:rgb (255, 255, 153);" > #在centos6.7 kernel 3.10.28 test, found that the write complete device name does not work (such as/DEV/PTS/2), this article is written in kernel 2.6.32, Last night just restarted the 3.10.28 of the kernel, the test is not OK, depressed. </span></span>

b) Skill

[WILSH@LCL ~]$ whatis Skill
Skill                (1)  -Send a signal or the process status
[WILSH@LCL ~]$ skill-9-T PTS/2
[WILSH@LCL ~]$ W
09:57:37 up 1 day, 17:28, 4 users, Load average:0.00, 0.00, 0.00
USER TTY from login@ IDLE jcpu pcpu WHAT
root tty3-09:25 31:32 0.10s 0.08s-bash
Roo   T pts/0 192.168.105.188 09:32 17:45 0.02s 0.02s-bash
root pts/1 192.168.105.188 09:36 17:39 0.01s 0.01s-bash
wilsh pts/2 192.168.105.188 09:57 0.00s 0.00s 0.00s w
[WILSH@LCL ~]$ skill-9-U wi Lsh


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.