• utmp will give you complete picture of users logins at which terminals, logouts, system events and current status of the system, system boot time (used by uptime) etc.
  • wtmp gives historical data of utmp.
  • btmp records only failed login attempts.
  • utmp will give you complete picture of users logins at which terminals, logouts, system events and current status of the system, system boot time (used by uptime) etc.
  • wtmp gives historical data of utmp.
  • btmp records only failed login attempts.

w and who Commands

The w and who commands pull information about who’s logged in and what they’re doing from the /var/run/utmp file. If you want to see the list of users who are currently logged in, use who:

$ who
geek    console  Jul  1 23:27
geek    ttys000  Jul  7 13:13
geek    ttys001  Jul 18 18:34

last Command

The last command provides how they logged in, when they logged in and when they logged out etc info on the screen.

Source: What is the purpose of utmp, wtmp and btmp files in Linux – The Geek Diary