How to List All Logged-in Users on Your Linux Computer

Spread the love

For your Linux system, it’s possible to have multiple users connected to a computer at the same time. The good thing is, you can easily find out who is on board and connected to the system. Learn how to list logged-in users on your Linux computer.

Also read: How to Easily Rename Files in Linux

1. Using the “who” command

We use the who command to get information on the different users connected with the information displayed in four columns.

  • The first column shows the usernames.
  • The second column indicates the TTY used.
  • The third column is the time the user logged in.
  • The fourth is the hostname or IP address of the connected users.

You can also display the number of users logged on to the system with the -q parameter.

It is possible to have more information by displaying all details of the current logged-in user with the -a option.

You can get more details on how to use the command by using the --help command if you need additional information.

2. Using the “w” command

Contrary to the who command, the w command shows the users who are logged in and what they are doing.

The output shows some useful information such as:

  • current time
  • how long the system has been running
  • number of users currently logged in
  • name of the logged-in user
  • remote host
  • time the user logged in

You can also display just the information about the logged-in users when you use the -h option.

You can filter the output of the command by using some other options. It’s possible to have a full list of the different options and their roles with the w --help command.

3. Using the “users” command

There is also the simple command users that shows only the users currently logged in without a parameter.

That command doesn’t give additional information like the other commands, but you still have an idea about the users currently logged in to the system. When you use the man users command, you see that there is no other information.

4. Using the “last” command

There is another command that we can use. The last command with the -a parameter gives you some information, such as the username (even the special users like “reboot”), TTY, IP address from where the users are connected, and some others.

When you use the -p parameter, it is possible to display the users connected to the present day.

The command also offers more options that can help you to have useful information. You can check with the man last command.

With all the commands above, you can easily list the logged-in users on Linux. This will allow you to monitor your system and see if there is any unauthorized access. You can take some actions with the identified users, if needed, with these users management commands.

Image credit: Panda for helping little skaters to teach skate on ice by Yayimages

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Alain Francois

A Linux system administrator passionate about Open-Source environments and working on installations, deployments for different IT solutions and cloud environments. I like to share my knowledge regarding the technologies that I can discover and use

Comments are closed