In this article will show you how to check the last login for users in Linux. For the same, you can use “last” or “lastlog” command to find which user logged in, login time and logged out. Usually the “last” command will use /var/log/wtmp file to search and display the list of all logged in and logged out users. The “lastlog” command will use /var/log/lastlog file to print the content of the last user logins with last login time, the port used and login (user) name.
The “lastlog” command will list the recent login of all the users logged into the system. To explore more in detail you can use -i option to show the IP-address of the source machine, also you can use –u options to find the last login of an individual user. You can also use man command for the last and lastlog to know more in detail with available command options. Here, for an example, I have used root user to find its last login time and source machine.
Checking the last login for Users in Linux:
- As a first step, logged into Linux operating system as a root user and continue with the below screenshots to check or to find the last login detail of an individual or for all the active or inactive users.
2. Check man page for more command options with “last” “lastlog”
[root@sa /]# man lastlog | more
[root@sa /]# man last | more
If you find this post is useful/helpful, please follow, like and share. Thank you for visiting my blog!!!