您的位置:首页 > 运维架构 > Linux

linux命令学习(46 47)-last lastlog

2013-02-10 23:15 344 查看
【命令名称】last
【使用权限】所有人
【命令语法】last
【功能说明】列出目前与过去登入系统的用户相关信息 指定文件/var/log/wtmp
【常用参数】
-n 只显示条数
-a 把IP地址显示在最后
【命令实例】
1 只显示10条
cxc@cxcserver ~]$ last -10
cxc pts/2 192.168.20.1 Wed Jan 2 19:06 still logged in
cxc pts/0 192.168.20.1 Wed Jan 2 19:06 still logged in
cxc pts/1 192.168.20.1 Wed Jan 2 17:16 - 19:32 (02:15)
cxc pts/1 192.168.20.1 Wed Jan 2 17:14 - 17:16 (00:02)
cxc pts/1 192.168.20.1 Wed Jan 2 17:13 - 17:14 (00:00)
cxc pts/0 192.168.20.1 Wed Jan 2 16:37 - 17:37 (00:59)
cxc pts/0 192.168.20.1 Wed Jan 2 15:43 - 16:37 (00:53)
cxc pts/0 192.168.20.1 Wed Jan 2 14:26 - 15:43 (01:17)
reboot system boot 2.6.18-308.24.1. Wed Jan 2 13:42 (06:10)
cxc pts/0 192.168.20.1 Mon Dec 31 21:49 - down (00:15)
wtmp begins Thu Dec 13 20:09:19 2012
2 也是显示10条,IP地址在最后面
[cxc@cxcserver ~]$ last -a -10
cxc pts/2 Wed Jan 2 19:06 still logged in 192.168.20.1
cxc pts/0 Wed Jan 2 19:06 still logged in 192.168.20.1
cxc pts/1 Wed Jan 2 17:16 - 19:32 (02:15) 192.168.20.1
cxc pts/1 Wed Jan 2 17:14 - 17:16 (00:02) 192.168.20.1
cxc pts/1 Wed Jan 2 17:13 - 17:14 (00:00) 192.168.20.1
cxc pts/0 Wed Jan 2 16:37 - 17:37 (00:59) 192.168.20.1
cxc pts/0 Wed Jan 2 15:43 - 16:37 (00:53) 192.168.20.1
cxc pts/0 Wed Jan 2 14:26 - 15:43 (01:17) 192.168.20.1
reboot system boot Wed Jan 2 13:42 (06:12) 2.6.18-308.24.1.el5
cxc pts/0 Mon Dec 31 21:49 - down (00:15) 192.168.20.1

wtmp begins Thu Dec 13 20:09:19 2012
cxc@cxcserver ~]$

【命令名称】lastlog
【使用权限】所有人
【命令语法】lastlog [-u 帐户名]
【功能说明】查找每个帐号的最近登入的时间
【常用参数】-u 后跟帐号
【命令实例】
1 查找每个帐号的最近登入的时间息
[cxc@cxcserver ~]$ lastlog
Username Port From Latest
root tty1 Sun Dec 30 22:19:13 +0800 2012 #root上次登录信息
bin **Never logged in**
nscd **Never logged in**
xfs **Never logged in**
---------------------------中间省略----------------------------------------
haldaemon **Never logged in**
avahi-autoipd **Never logged in**
cxc pts/0 192.168.20.1 Wed Jan 2 15:43:55 +0800 2013 #cxc最近登录信息
ntp **Never logged in**
test **Never logged in**
cxx **Never logged in**
[cxc@cxcserver ~]$lastlog –u cxc #只查找cxc
Username Port From Latest
cxc pts/0 192.168.20.1 Wed Jan 2 15:43:55 +0800 2013
[cxc@cxcserver ~]$
本文出自 “崔子涵涵” 博客,请务必保留此出处http://chinalscxc.blog.51cto.com/1382308/1133352
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: