命令格式
用法:lastlog [选项]
常用选项
选项: -b, --before DAYS 仅打印早于 DAYS 的最近登录记录 -C, --clear clear lastlog record of an user (usable only with -u) -h, --help 显示此帮助信息并推出 -R, --root CHROOT_DIR chroot 到的目录 -S, --set set lastlog record to current time (usable only with -u) -t, --time DAYS 仅打印晚于 DAYS 的最近登录记录 -u, --user LOGIN 打印 LOGIN 用户的最近登录记录 12345678
参考示例
显示系统中所有用户最近一次登录信息
[root@itcast ~]# lastlog
显示指定天数前的登录信息
[root@itcast ~]# lastlog -b 7
显示指定天数以来的登录信
[root@itcast ~]# lastlog -t 7 用户名 端口 来自 最后登陆时间 root pts/0 六 8月 3 10:27:37 +0800 2019 deng pts/0 172.16.0.51 六 8月 3 10:27:30 +0800 2019 itcast pts/1 三 7月 31 21:25:50 +0800 2019 [root@itcast ~]#
显示指定用户的最近登录信息
[root@itcast ~]# lastlog -u root 用户名 端口 来自 最后登陆时间 root pts/0 六 8月 3 10:27:37 +0800 2019 [root@itcast ~]#
清除指定用户的登录信息
[root@itcast ~]# lastlog -C -u root [root@itcast ~]# [root@itcast ~]# [root@itcast ~]# lastlog -u root 用户名 端口 来自 最后登陆时间 root **从未登录过** [root@itcast ~]#
以上就是
为各位朋友分享的 相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多 等着你 !