You can also use the command lastlog
command on Linux. It gives you more granular controls as to ranges of dates when looking through the logs of user logins.
excerpt from lastlog man page
lastlog - reports the most recent login of all users or of a given user
Example
To find out the users that have logged into a system in the last 100 days.
$ lastlog -b 0 -t 100
Username Port From Latest
sam pts/0 pegasus Wed Jan 8 20:32:25 -0500 2014
joe pts/0 192.168.1.105 Thu Dec 12 12:47:11 -0500 2013
This shows that the last times these users logged into this system. The range of time shows the last 100 days. Before today (-b 0
) and after 100 days ago (-t 100
).
You can also show all the users by omitting any range and just seeing every usre that's ever logged in, and the last time they logged in.
/var/log/wtmp
file is present and its last change time usingstat
.last | tac
stat /var/log/wtmp