How To: Show User Information In The Linux Terminal

There comes a time in many Linux journeys when you want to know how to show user information in the Linux terminal. Well, if you’ve been waiting for such an article, this article is for you. After all, knowing about the various users might be important information for you.

You may not realize this, but your Linux system has all sorts of users. They belong to varied groups, sometimes more than one group at a time. Unless you’re already familiar with this subject, you probably have more users than you realize. 

That’s perfectly okay. It’s entirely normal to have different users. Linux is a user-oriented operating system. Users have varied permissions and can perform different tasks based on those permissions. 

This actually shouldn’t be a complicated article. It’s just a couple of commands, though the command may not be well-known among the newer Linux users. New users should familiarize themselves with the concepts of a multi-user system and with groups.

Anyhow, you shouldn’t need to install anything. The tools we’ll be using should be installed by default. You will need an open terminal. So, you have been warned. After all, it was right there in the title!

lslogins:

The tool we’ll expose you to today is ‘lslogins‘, which should be installed by default. You can verify that lslogins is installed with this command:

And, if you check the man page (with man lslogins) you’ll see this:

lslogins – display information about known users in the system

So, sure enough, that looks like it’s the correct tool for the job. Our goal is to show user information in the Linux terminal. This looks like a good way to go about it.

Show User Information In The Linux Terminal:

Yes, we’re doing this in the terminal. You can frequently open your terminal by pressing CTRL + ALT + T. Otherwise, you’ll find a terminal emulator somewhere within your application menu. It’s likely to be in the admin section of said menu.

With your terminal open, you can start with the basics. That is, we’re going to show all the known users with the lslogins command. That syntax is so simple.

You’ve got a lot of users. You may not know it yet, but you do. Here’s an example output from my system:

Now, that’s all well and good.

But…

Let’s say you only want to show user information about one single user. That’s fine and you can do that in a variety of ways. You can also do it just as easily with the lslogins command, simply by using the -u flag. 

The syntax is as follows:

An example output might look like this:

And there’s the information about the root user. You can try with your username and get information about things like the groups you belong to and more. Go ahead and give it a shot, you won’t break anything. I promise you won’t break anything with this command!

Closure:

You never know when you’re going to want to show user information in the terminal. It is useful information, especially when debugging things like permission errors. You may find you need to add yourself to a group or things like that. So, store this command away in your mental bank and save it for when you need this information.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.