Linux的lastlog命令如何使用


这篇文章主要介绍了Linux的lastlog命令如何使用的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇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 2022 deng             pts/0    172.16.0.51      六 8月  3 10:27:30 +0800 2022 itcast           pts/1                     三 7月 31 21:25:50 +0800 2022 [root@itcast ~]#

显示指定用户的最近登录信息

 [root@itcast ~]# lastlog -u root 用户名           端口     来自             最后登陆时间 root             pts/0                     六 8月  3 10:27:37 +0800 2022 [root@itcast ~]#

清除指定用户的登录信息

 [root@itcast ~]# lastlog -C -u root [root@itcast ~]# [root@itcast ~]# [root@itcast ~]# lastlog -u root 用户名           端口     来自             最后登陆时间 root                                       **从未登录过** [root@itcast ~]#

关于“Linux的lastlog命令如何使用”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“Linux的lastlog命令如何使用”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注主机评测网行业资讯频道。


上一篇:Centos8下怎么使用Sysbench进行性能测试

下一篇:Linux的tailf命令有什么用


Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器