[root@vps1001 ~]# w
00:34:21 up 48 days, 23:38, 4 users, load average: 0.79, 0.58, 0.56
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
magesh pts/0 192.168.1.101 19:47 4:45m 0.04s 0.00s sh /opt/scripts/disk-usage.sh
renush pts/1 192.168.1.102 20:35 3:54m 2:23 0.00s sh bash
thanis pts/2 192.168.1.103 00:27 5.00s 0.08s 0.04s ssh
root pts/4 192.168.1.104 00:34 1.00s 0.02s 0.01s w
有了它之后,使用PS命令找到相应的tty会话的PID。
ps -ft [tty]
[root@vps1001 ~]# ps -ft pts/4
UID PID PPID C STIME TTY TIME CMD
root 155183 155092 0 00:34 pts/4 00:00:00 -bash
root 163015 155183 0 00:35 pts/4 00:00:00 ps -ft pts/4
最后杀死会话的进程ID。
kill -9 PID
kill -9 155183
评论区