last查看登陆过的用户:

last -n 3

qiyang   pts/1        192.168.96.131   Wed Nov 29 03:32   still logged in   

root     pts/0        192.168.96.131   Wed Nov 29 01:24   still logged in 

still logged in表示任然在登陆状态

文件位置在 /var/log/wtmp


lastb查看尝试登陆且登陆失败的用户:

lastb -n 30

    -n        表示显示条数,不加也可以

root     ssh:notty    123.169.6.163    Wed Dec 13 15:27 - 15:27  (00:00)    

文件位置 /var/log/btmp


lastlog显示每个用户最近一次登陆的信息:

    -u username    显示特定用户

lastlog -u root