-
查看登录用户,使用w命令
[root@lnmp ~]# w
18:51:18 up 35 min, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.66.180 18:15 0.00s 0.27s 0.08s w
huwei pts/1 192.168.66.180 18:51 3.00s 0.04s 0.04s -bash
2.踢出登录的用户:pkill -KILL -t pts/* *代表W下用户登录终端名,本例中huwei的TT为:pts/1
[root@lnmp ~]# pkill -KILL -t pts/1
[root@lnmp ~]# w
18:54:14 up 38 min, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.66.180 18:15 0.00s 0.19s 0.00s w