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

List Logged In Users Linux Featured

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.

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.

Connected Users Who Command
  • 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.

Connected Users Who Q Output

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

Connected Users Who A Output

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

Connected Users Who Help Output

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.

Connected Users W Command

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.

Connected Users W H Output

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.

Connected Users W Help Output

3. Using the “users” command

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

Users Output 1

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.

Connected Users Manual Output

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.

Connected Users Last Command

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

Connected Users Last P Output

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

Connected Users Last Manual Output Min

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

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

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox