Linux use the following two files to keep track of user login sessions:
a] /var/run/utmp – List of current login sessions.
b] /var/log/wtmp – List of previous login sessions.
c] /var/log/btmp – List all the bad login attempt.
Last command
The last command searches back through the file /var/log/wtmp file and displays a list of all users logged in (and out) since that file was created. Names of users and tty’s can be given, in which case last will show only those entries matching the arguments. Names of ttys can be abbreviated, thus last 0 is the same as last tty0. Type the following command:
last
last username
Task: Find Out Who Was Logged In At A Particular Time
To display the state of logins as of the specified time to determine easily who was logged in at a particular time specify that time with -t option and look for “still logged in”.
last -t YYYYMMDDHHMMSS
last -t 20091028231100 username