Warning icon

New location coming soon: Madrid, Spain

How to List Users on Ubuntu Linux VPS

How to List Users on Ubuntu Linux VPS

Reasons to View System Users in Ubuntu 

It’s a well-known fact that the Linux server is the most preferred server among tech-enthusiasts for quite a number of amazing reasons. First, the Linux server is very powerful and can support the performance of as many activities you would like to carry on. It is open-source, safe and secure, has an amazing community, is always improving on features and is highly cost-effective. 

As a result of the many benefits the Linux server offers especially for tech-personnel, it has become the favorite server for many groups and organizations and is used by many for team-based projects and collaborative works especially because it allows multiple logins. As such, the Linux server has multiple users at a time.

As expected, managing multiple server users at a time is a daunting task and system administrators have had to find a way to effectively control user’s interaction on the system. Ubuntu VPS features have been effective in achieving this and have helped administrators carry out functions like modifying systems, granting access to Ubuntu list users to view certain data, etc.

For security reasons, you would need to see permissions and verify the activities of other Ubuntu list users and as such, it’s important for you to know how to list users on your Ubuntu VPS before configuring the settings.

How to List Users on Ubuntu

To list users on Ubuntu VPS is to know the numbers of Ubuntu list users as well as verify their activities on the system. 

You can view Ubuntu list users in 3 ways: 

1.Viewing Ubuntu list Users using the/etc/passwd File. You would need less or cat to access this file which has the information of local Ubuntu list users stored in it. This is the syntax: 

johndoe:x:1000:1000:John Doe,,,:/home/helder:/bin/bash

/etc/passwd (END)

A careful observation would show that there are 7 fields in each line and each of them contains basic information like the username, user ID, encrypted password, group ID number, full name, user home directory and login shell of the Ubuntu list users.

2. Viewing Ubuntu list Users using the getent command: Viewing Ubuntu list users with the getent command will propose similar results as the etc/passwrd. It can, however, be used to query a list of all users through displaying entries from databases configured in /etc/nsswitch.conf file and the passwrd database. 

3. Viewing Ubuntu list users using the compgen command: To view the usernames of Ubuntu list users without more, the compgen command would come in handy. To achieve this, you would use the -u function  and the result would be like this:

compgen -u



You can also use the compgen command with the -c option when you don’t have sudo access or you are not the admin on a linux system, to list all the commands available to you. 

You can use the grep command to check if a user exists on a Linux system using this syntax: getent passwd | grep jane assuming the user’s name is Jane. Jane’s login details will be displayed if she’s a user and if she’s not, there would be no output.

Viewing All Users on Linux 

To view all Ubuntu list users on your Ubuntu VPS / Linux server, you would need to access the content of the passwrd file which contains all the information about all registered Ubuntu list users. The file is located in the  /etc/passwd.
On your VPS terminal, type less /etc/passwd and expect to see a password like this: 


Each line contains information about the username, password, User ID, Group ID, full name, home directory and user shell of the Ubuntu list users in that order.

Viewing Groups on Linux

The Linux server allows the VPS users to create and group Ubuntu list users to make it easier to grant a group of people access especially if they are using the same system. While individual information of Ubuntu list users is stored in /etc/passwd, the information of a group is stored in  /etc/group. 

To access the information on this file, go to your VPS terminal, and type less /etc/ group 

Expect the following output: 

.  . . 

The Linux server uses the  UPG scheme which allows Ubuntu list users to have their personal private group.

Viewing Logged In Users 

The process of viewing logged in Ubuntu list users is an easy one. All you need to do is open your VPS terminal and type this command: w 

The result will show you the active Ubuntu list users and also include extra information about the remote host, login time, etc. 

Here’s a breakdown of the result: 

User – This is the username of the Ubuntu VPS/ server user 

TTY- This is the terminal name of the VPS/ server user 

From- The remote hostname of the VPS/ server user

Login@ – Details of the login time of the VPS/ server user 

Idle – The idle time of the VPS/ server user 

JCPU- This displays information about the length of time the processes attached to the TTY uses. 

PCPU- This displays information about the time used by the process in the WHAT field. 

WHAT- This displays information about the user’s current process. 

The “who” command performs similar functions with the w command. However, it does not display as much detailed output as the w command does. The “who” command displays an output that looks like this: 

root     pts/0     2019-10-21 10:02