加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

lastlog命令用于显示系统中所有用户最近一次登录信息

发布时间:2023-09-13 15:03:00 所属栏目:Linux 来源:
导读:Linux常用命令lastlog命令用于显示系统中所有用户最近一次登录信息,下面为大家分享一下Linux常用命令lastlog命令具体使用方法。

命令格式

用法:lastlog [选项]

常用选项

选项:

-b, --bef
Linux常用命令lastlog命令用于显示系统中所有用户最近一次登录信息,下面为大家分享一下Linux常用命令lastlog命令具体使用方法。

命令格式
 
 用法: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 ~]#
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章