A disconnected user is interrupted in a Linux system

Source: Internet
Author: User
Tags pkill

1, use the W command to view the current system login user

[[Email protected] ~]# W Geneva: -:GenevaUp4: *,3Users, load average:0.00,0.01,0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0    192.168.1.100     Geneva: -    4.00s0.06s0. 02s wlxj2 pts/1    192.168.1.100     Geneva: -    -.00s0.00s0.00s-Bashrusky pts/2    192.168.1.100     Geneva: -    5.00s0.01s0.01s-Bash[[email protected]~]#

user-logged in User name
tty-system-assigned terminal number after login
from-remote host name, where to log in from
[Email protected]-when to login
How long the idle-is idle, indicating when the user is idle. This is a timer that will be reset once the user performs any action
The time taken by all processes jcpu-and the terminal (TTY) connection, which does not include the past background job time, but includes the time occupied by the currently running background job
Pcpu-refers to the time taken by the current process (that is, the process displayed in the What item)
what-the command line that is currently running the process

2, use the ps-u username command to view the user process, and then kill the corresponding user's sshd process

[[Email protected] ~]# PS-u lxj2 PID TTY time CMD3143?xx:xx:xxsshd3144pts/1    xx:xx:xxBash[[email protected]~]# Kill-9 3143[[Email protected]~]# PS-u lxj2 PID TTY time Cmd[[email protected]~]# WGeneva:Ten: -Up5: $,2Users, load average:0.00,0.01,0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0    192.168.1.100     Geneva: -    1.00s0.17s0. 00s Wrusky pts/2    192.168.1.100    Geneva:Geneva    1: 07m0.00s0.00s-Bash[[email protected]~]#

3, there is another way to use the Pkill command to terminate the user connection

[[Email protected] ~]# W .: -: AUp8: *,3Users, load average:0.00,0.01,0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0    192.168.1.100     Geneva: -    6.00s0.18s0. 01s wlxj2 pts/1    192.168.1.100     .: -    3.00s0.02s0.02s-Bashrusky pts/2    192.168.1.100    Geneva:Geneva    3: 45m0.00s0.00s-Bash[[email protected]~]# pkill-kill-t pts/1[[Email protected]~]# W .: the:GenevaUp8: $,2Users, load average:0.00,0.01,0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0    192.168.1.100     Geneva: -    0.00s0.18s0. 00s Wrusky pts/2    192.168.1.100    Geneva:Geneva    3: 46m0.00s0.00s-Bash[[email protected]~]# pkill-kill-t pts/2[[Email protected]~]# W .: the: -Up8: $,1User, load Average:0.00,0.01,0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0    192.168.1.100     Geneva: -    6.00s0.19s0. 01s W[[email protected]~]#

A disconnected user is interrupted in a Linux system

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.