w 命令
命令描述:查询当前登录的终端
[root@***~]# w
#第一行含义
#当前系统时间,开机时间,当前登录用户数量,系统在以分钟、五分钟、十分钟前的平均负载
11:16:27 up 1:47, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 1.2.3.1 10:39 3.00s 0.04s 0.01s w
root pts/1 1.2.3.1 10:24 8:27 0.04s 0.02s bash
who 命令
命令描述:查询当前登录的终端(显示的内容比w少)
[root@***~]# who
用户名 终端编号 登录时间
root pts/0 2020-04-17 10:39 (1.2.3.1)
root pts/1 2020-04-17 10:24 (1.2.3.1)
last 命令
命令描述:查看系统所有登录过的用户信息,包括正在登录的用户
[root@***~]# lastroot pts/0 1.2.3.1 Fri Apr 17 10:39 still logged in
root pts/1 1.2.3.1 Fri Apr 17 10:24 still logged in
root tty1 Sun Jan 12 04:27 - crash (04:06)
reboot system boot 3.10.0-1062.el7. Sun Jan 12 04:26 - 09:28 (96+05:02)
wtmp begins Sun Jan 12 04:26:48 2020
还会显示系统重启的时间
lastlog 命令
命令描述:查看系统中所有用户最后一次登录的时间
[root@***~]# lastlog
用户名 端口 来自 最后登陆时间
root pts/0 1.2.3.1 五 4月 17 10:39:14 +0800 2020
bin **从未登录过**
daemon **从未登录过**
adm **从未登录过**
lp **从未登录过**
sync **从未登录过**
shutdown **从未登录过**
halt **从未登录过**
mail **从未登录过**
operator **从未登录过**
games **从未登录过**
ftp **从未登录过**
nobody **从未登录过**
systemd-network **从未登录过**
dbus **从未登录过**
polkitd **从未登录过**
tss **从未登录过**
sshd **从未登录过**
postfix **从未登录过**
user1 pts/1 五 4月 17 10:35:52 +0800 2020
lastb 命令
命令描述:查看错误的登录信息
[root@***~]# lastb
root pts/1 Fri Apr 17 11:37 - 11:37 (00:00)
btmp begins Fri Apr 17 11:37:39 2020
本文介绍Linux系统中查询登录记录的几种常用命令,包括w、who、last、lastlog及lastb,详细解释了各命令的功能及输出信息,帮助用户了解系统登录活动。
263

被折叠的 条评论
为什么被折叠?



