The bash command last
(needs sudo) prints out logs, which contain information on when different users log in/out of the shell.
I have been looking for the file that stores this information, that last
would access. I have checked /var/log/system.log
and other files within /var/log
.
I have looked everywhere on the internet as well, and cannot find the location.
I have, however, confirmed that the file is within /var/log
, because when I did rm -rf /var/log/
, sudo last
showed empty output until the next time I logged in.
Which file is it? Thanks.
(I am using OS X Mavericks if it makes a difference.)
Best Answer
last
derives its output by examining the *.launchd.events.*.stats files in /private/var/log/com.apple.launchd.Removing the files usually restricts the
last
output to the last login after rebooting. Consequently some additional file/database/in-memory structure has to exist.Removing the files doesn't work consistently.
The stats files in the respective user folders (e.g. com.apple.launchd.peruser.0 or com.apple.launchd.peruser.501) are irrelevant!