can anyone please tell me how can I make a list of users who have logged in yesterday or earlier but have not logged out yet. without repeating the same user in the list.
In order to find last login times for all users on your Linux machine, you can use the “lastlog” command with no options. By default, you will be presented with the list of all users with their last login attempts. Alternatively, you can use the “-u” option for “user” and specify the user you are looking for.
Linux Command To List Current Logged In Users. w command – Shows information about the users currently on the machine, and their processes. who command – Display information about users who are currently logged in.
last | fgrep "still logged in" | cut -d" " -f1 | uniq -u
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With