Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the lslogins command that provides some useful details on user accounts and logins. In its simplest form, you could just type lslogins, but without using sudo, some of the details you’ll probably want to see won’t be available because the files in which it’s stored won’t be readable. So, let’s run the command with sudo and see what it shows us. I’m adding the -u option so that the output will show only user accounts, not the large group of service accounts like daemon, mail and syslog.
As you can see, we get the UIDs and usernames. PROC shows the number of processes being run. PWD-LOCK and PWD-DENY will indicate locked accounts. LAST-LOGIN shows the date or time (if today) of the most recent login and GECOS shows the field from the /etc/passwd file that describes the user.
To show details for just one user, specify the username as an argument. Notice how much more detail is provided such as the user’s group memberships and the last IP the user logged in from.
That’s your Linux tip for lslogins.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.