Updated: 3 November 2026 · Applies to: Linux, coreutils and glibc's getent

To list every user on a Linux system from the command line, read /etc/passwd, which has one line per account, human and system accounts both. cat /etc/passwd shows the whole file, or pull out just the parts you want with cut, awk, or getent.

See the raw file

cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
...

Each line has seven colon separated fields: username, a placeholder where the password used to be stored before shadow passwords, user ID, group ID, a comment field (often the full name), home directory, and login shell.

List just the usernames with cut

cut pulls out one field from each line of a delimited file:

cut -d: -f1 /etc/passwd
root
daemon
bin
sys
sync
...

-d: sets the colon as the field delimiter, and -f1 prints only the first field, the username.

List only real human accounts, not system accounts

System and service accounts typically use a home directory under /home only rarely; filtering for that is a quick, imperfect way to see mostly real user accounts:

grep "/home" /etc/passwd | cut -d: -f1

For an exact answer instead of an approximation, most distributions set real user accounts to start at UID 1000, with everything below that reserved for the system:

awk -F: '$3 >= 1000 {print $1}' /etc/passwd

Print a nicer formatted list with awk

awk lets you pick out fields and lay them out however you want, rather than just printing one raw field like cut:

awk -F: '{print "Login:" $1 "\tHome:" $6}' /etc/passwd
Login:root	Home:/root
Login:daemon	Home:/usr/sbin
Login:bin	Home:/bin
...

Use getent instead of reading the file directly

getent asks the system's configured name service, which might be the local file, LDAP, or something else entirely depending on how the system is set up, rather than assuming everything is in /etc/passwd. With no further options it defaults to the passwd database, listing every user the same way:

getent passwd

List every group the same way

getent group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
...

Find which groups one specific user belongs to

groups username

Or, to search the other direction and see every group a specific username is a member of, straight from the group database:

getent group | grep username

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $131.99 a month.

Was this answer helpful?

Still stuck? Open a ticket