Reading Time 2
Number of Words 245
Users are fundamental in any Linux system since they allow us to log in and perform tasks based on assigned permissions such as administration, reading, or writing. Depending on these permissions, each user has a specific level of authority in the system.
It is important to know which users are registered, especially if we want to remove inactive accounts or maintain proper security. On a personal level, it is also useful to identify unnecessary users and clean up the system.
Read the latest version 2025 here (How to list all users in Ubuntu 2025).
Checking User Information in /etc/passwd
All user information is stored in the /etc/passwd file. To view its content, run the following command in the terminal:
sudo cat /etc/passwd
Each line in this file represents a user and contains fields separated by a colon. These fields include:
-
Username
-
Encrypted password (the letter
xindicates it is stored in/etc/shadow) -
User Identification Number (UID)
-
Group Identification Number (GID)
-
Full user name (GECOS field)
-
Home directory
-
Login shell (by default
/bin/bash)
Display Only Usernames
If you only want to list usernames without additional details, use the cut command to extract the first field:
cut -d: -f1 /etc/passwd
This command prints only the usernames in a clean and simplified list.
Example of User List
Below is an example of how the users appear in Ubuntu, with each one separated by a line and their details divided by colons:
user1:x:1000:1000:User One:/home/user1:/bin/bash user2:x:1001:1001:User Two:/home/user2:/bin/bash
Conclusion
Listing all users in Ubuntu 20.04 is straightforward using the /etc/passwd file. Depending on your needs, you can either view full details or extract only the usernames. This helps maintain better control and organization of your system accounts.