How to list users on Linux

User management is an important part of Linux administration, so it’s essential to know about all the user accounts on a Linux system and how to disable user accounts, etc. In this guide, we’ll show you how to list the current users via command line and GUI. This will include a GNOME desktop environment as well as KDE.

In this tutorial you will learn:

  • How to list users via command line
  • How to list users on GNOME GUI
  • How to list users on KDE GUI

List of users on a Linux system

List of users on a Linux system

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

List users via command line



User information is stored in the system’s /etc/passwd file. Looking at the contents of this file will allow us to see a list of the users on a system. Each user will take up one line in the file.

Open a terminal on your system and type the following command to list all users:

$ cat /etc/passwd
Full list of users with extra data fields

Full list of users with extra data fields

At the beginning of every line is the name of a user account. In total, there are seven fields of data which are separated by colons. To help you comprehend this file, here’s what each field means:

  • User name
  • Encrypted password (x indicates the password is stored in /etc/shadow
  • User ID number
  • User group ID number
  • User’s full name
  • Path to user’s home directory
  • Default shell

Since this output is way too much if we only need the names of the users, we can use the awk command to display only the user names of the accounts.

$ awk -F: '{ print $1}' /etc/passwd
List of users that only shows usernames

List of users that only shows usernames



To check for a specific user, you can always pair this with the grep command:

$ awk -F: '{ print $1}' /etc/passwd | grep root

List users on GNOME GUI

To see a list of users in GNOME, you’ll need to install the gnome-system-tools package. You can install it by typing the following command in terminal if you’re running Ubuntu or another Debian based distro:

$ sudo apt install gnome-system-tools

Arch Linux and Manjaro:

$ sudo pacman -S gnome-system-tools

Fedora and CentOS:

$ sudo dnf install gnome-system-tools

Once it’s installed, you’ll be able to open the Users & Groups application.

Search for and open Users and Groups

Search for and open Users and Groups



This application will list the normal users on the system, but it doesn’t list system users.

List of users in GNOME

List of users in GNOME

List users on KDE GUI

KDE has a built in user management menu. You can simply search for it in the app launcher.

Search for User Manager in KDE

Search for User Manager in KDE



The list of users will be shown here.

List of users in KDE

List of users in KDE

Conclusion

In this article, we saw how to list users on a Linux system. We learned about a command line method, which was proven ideal for listing all normal and system users, but we also learned how to do it in GUI via GNOME and KDE desktop environments. The GUI methods are effective but they don’t list system users. You should pick whichever method is easier for you and most appropriate for the situation at hand.



Comments and Discussions
Linux Forum