How to list users by last login?

To list users by their last login time, you can use the last command in Linux. This command shows a list of the last logged-in users. Here’s how to use it:

last

Explanation:

  • The last command reads from the /var/log/wtmp file and displays a list of users who have logged in, along with their login times and durations.

Additional Options:

  • To limit the output to a specific number of entries, you can specify a number:
last -n 10

This will show the last 10 login entries.

  • If you want to see the last login for a specific user, you can specify the username:
last username

If you have any more questions or need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!