码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 之 w who lastlog 命令例子

时间:2018-05-15 17:37:39      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:w who lastlog

w who lastlog 命令例子

w 查看当前登陆用户和当前操作

[root@masterdata-app1 ~]# w
 22:52:39 up 133 days, 16:47,  8 users,  load average: 0.77, 0.31, 0.32
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    remotepc.cedarhd 22:08   32:22   0.07s  0.04s vi applicationContext.xml
root     pts/2    10.3.244.3       22:47    0.00s  0.02s  0.00s w
root     tty1     :0               28Apr18 133days  1:17   1:17  /usr/bin/Xorg :0 -br -verbose -audit 4 -auth /var/run/gdm/au
root     pts/1    :0.0             28Apr18 16days  0.06s  0.06s /bin/bash
root     pts/5    remotepc.cedarhd 20:00    7:27   0.15s  0.15s -bash
root     pts/6    remotepc.cedarhd 21:01   60.00s  0.06s  0.06s -bash
root     pts/7    remotepc.cedarhd 21:30   44.00s  1:32   0.02s -bash
root     pts/8    remotepc.cedarhd 21:30    1:21m  0.10s  0.07s tail -500f catalina.out

who 查看当前登陆的用户

[root@masterdata-app1 ~]# who
root     pts/0        2018-05-14 22:08 (remotepc.cedarhd.com)
root     pts/2        2018-05-14 22:47 (10.3.244.3)
root     tty1         2018-04-28 15:22 (:0)
root     pts/1        2018-04-28 15:22 (:0.0)
root     pts/5        2018-05-14 20:00 (remotepc.cedarhd.com)
root     pts/6        2018-05-14 21:01 (remotepc.cedarhd.com)
root     pts/7        2018-05-14 21:30 (remotepc.cedarhd.com)
root     pts/8        2018-05-14 21:30 (remotepc.cedarhd.com)

踢出pts/2用户的方法:

[root@masterdata-app1 ~]# who
root     pts/0        2018-05-14 22:08 (remotepc.cedarhd.com)
root     pts/2        2018-05-14 22:47 (10.3.244.3)
root     tty1         2018-04-28 15:22 (:0)
root     pts/1        2018-04-28 15:22 (:0.0)
root     pts/5        2018-05-14 20:00 (remotepc.cedarhd.com)
root     pts/6        2018-05-14 21:01 (remotepc.cedarhd.com)
root     pts/7        2018-05-14 21:30 (remotepc.cedarhd.com)
root     pts/8        2018-05-14 21:30 (remotepc.cedarhd.com)
[root@masterdata-app1 ~]# pkill -kill -t pts/2

lastlog 查看所有用户最后登陆时间

[root@masterdata-app1 ~]# lastlog
Username         Port     From             Latest
root             pts/2    10.3.244.3       Mon May 14 22:47:03 +0800 2018
bin                                        **Never logged in**
daemon                                     **Never logged in**
adm                                        **Never logged in**
lp                                         **Never logged in**
sync                                       **Never logged in**
shutdown                                   **Never logged in**
halt                                       **Never logged in**
mail                                       **Never logged in**
uucp                                       **Never logged in**
operator                                   **Never logged in**
games                                      **Never logged in**

Linux 之 w who lastlog 命令例子

标签:w who lastlog

原文地址:http://blog.51cto.com/12965094/2116348

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!