一旦工作,那就要努力的干,聪明的干,快速的干——用省下来的时间干自己喜欢干的事情。!

linux查看在线用户、用户登录历史以及踢出用户

linux lampnick 2491℃ 0评论

1、查看在线用户
使用命令:w

[root@localhost ~]# w
 15:21:41 up 21 days, 16:27, 4 users, load average: 0.53, 1.29, 3.76
 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
 root pts/0 127.0.0.1 10:51 2:47m 14.16s 0.04s -bash
 root pts/1 127.0.0.1 14:03 1:18m 0.02s 0.02s -bash
 root pts/2 127.0.0.1 14:04 1:17m 0.02s 0.02s -bash
 root pts/3 127.0.0.1 14:09 5.00s 0.07s 0.07s -bash

2、查看用户登录历史:
last

[root@localhost ~]# last
 root pts/4 127.0.0.1 Tue Mar 29 15:18 - 15:19 (00:00)
 root pts/3 127.0.0.1 Tue Mar 29 14:09 still logged in
 root pts/2 127.0.0.1 Tue Mar 29 14:04 still logged in
 root pts/1 127.0.0.1 Tue Mar 29 14:03 still logged in
 root pts/0 127.0.0.1 Tue Mar 29 10:51 still logged in
 root pts/5 127.0.0.1 Mon Mar 28 21:53 - 22:52 (00:59)
 root pts/4 127.0.0.1 Mon Mar 28 14:01 - 00:46 (10:45)
 root pts/3 127.0.0.1 Mon Mar 28 11:39 - 00:46 (13:07)

3、踢出用户:

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

转载请注明:MitNick » linux查看在线用户、用户登录历史以及踢出用户

喜欢 (1)or分享 (0)
头像
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址