linux查看在线用户并踢出用户

编程

1、查看在线用户

w

[qiao@qiao-linux ~]$ w

15:32:44 up 2:52, 1 user, load average: 6.75, 3.98, 2.55

USER TTY LOGIN@ IDLE JCPU PCPU WHAT

qiao tty2 15:24 2:51m 0.03s 0.03s /usr/libexec/gnome-session-binary

2.查看用户登录历史 last

[qiao@qiao-linux ~]$ last

qiao tty2 tty2 Mon Jun 8 15:24 still logged in

qiao tty2 tty2 Mon Jun 8 15:21 - 15:23 (00:02)

qiao tty2 tty2 Mon Jun 8 12:41 - 15:21 (02:39)

reboot system boot 5.6.15-300.fc32. Mon Jun 8 20:40 still running

qiao tty2 tty2 Sun Jun 7 22:22 - down (09:57)

reboot system boot 5.6.15-300.fc32. Mon Jun 8 06:21 - 08:19 (01:58)

qiao pts/0 q Sun Jun 7 22:07 - down (00:13)

qiao pts/1 q Sun Jun 7 22:02 - down (00:19)

qiao tty2 tty2 Sun Jun 7 21:19 - down (01:01)

reboot system boot 5.6.15-300.fc32. Mon Jun 8 05:13 - 22:21 (-6:52)

qiao tty2 tty2 Sun Jun 7 20:47 - down (00:06)

reboot system boot 5.6.15-300.fc32. Mon Jun 8 04:46 - 20:53 (-7:52)

qiao tty2 tty2 Sun Jun 7 16:51 - crash (11:54)

reboot system boot 5.6.15-300.fc32. Mon Jun 8 00:50 - 20:53 (-3:56)

qiao tty2 tty2 Sun Jun 7 12:59 - down (03:50)

qiao tty2 tty2 Sun Jun 7 12:40 - 12:59 (00:18)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 20:00 - 16:50 (-3:10)

qiao tty2 tty2 Sun Jun 7 11:16 - down (00:43)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 19:15 - 11:59 (-7:15)

qiao tty2 tty2 Sun Jun 7 11:11 - down (00:03)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 19:10 - 11:15 (-7:55)

qiao tty2 tty2 Sun Jun 7 10:47 - down (00:23)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 17:51 - 11:10 (-6:40)

qiao tty2 tty2 Sun Jun 7 09:19 - down (00:02)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 17:18 - 09:21 (-7:56)

qiao tty2 tty2 Sun Jun 7 09:03 - down (00:14)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 17:02 - 09:17 (-7:44)

qiao tty2 tty2 Sun Jun 7 08:51 - down (00:10)

qiao tty2 tty2 Sun Jun 7 07:53 - 08:51 (00:57)

qiao tty2 tty2 Sat Jun 6 22:01 - 07:53 (09:51)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 06:00 - 09:01 (03:01)

qiao tty2 tty2 Sat Jun 6 21:48 - down (00:11)

qiao tty2 tty2 Sat Jun 6 19:25 - 21:48 (02:22)

qiao tty2 tty2 Sat Jun 6 19:06 - 19:25 (00:18)

qiao tty2 tty2 Sat Jun 6 17:40 - 19:06 (01:25)

qiao tty2 tty2 Sat Jun 6 17:38 - 17:40 (00:01)

qiao tty2 tty2 Sat Jun 6 16:07 - 17:37 (01:30)

reboot system boot 5.6.15-300.fc32. Sun Jun 7 00:06 - 22:00 (-2:06)

qiao tty2 tty2 Sat Jun 6 15:56 - down (00:08)

reboot system boot 5.6.15-300.fc32. Sat Jun 6 23:55 - 16:05 (-7:50)

qiao tty2 tty2 Sat Jun 6 14:59 - down (00:55)

qiao tty2 tty2 Sat Jun 6 14:58 - 14:59 (00:01)

reboot system boot 5.6.6-300.fc32.x Sat Jun 6 22:54 - 15:55 (-6:58)

wtmp begins Sat Jun 6 22:54:02 2020

3.踢出用户

pkill -KILL -t pts/0 #pts/0为w指令看到的用户终端号

以上是 linux查看在线用户并踢出用户 的全部内容, 来源链接: utcz.com/z/517222.html

回到顶部