The Easy, Practical, and Reliable Ways to View All Users on Your Linux System
If you’ve ever wondered how to check all users in Linux, you’re not alone. Whether you’re managing a personal server, administering an enterprise system, or learning the ropes as a new Linux user—knowing how to list users on Linux is a basic skill that pays off big time.
In this guide, we’ll show you multiple ways to list all users in Linux, explain what each method does, and why it matters. We’ve also packed in some pro tips and answers to the most common questions Linux users ask about accounts and permissions.
Why Do You Need to List Users on Linux?
Knowing who’s on your system isn’t just for curiosity—it’s about control, security, and good system hygiene. When you’re managing Linux:
- You need to know which user accounts exist
- You might need to check login permissions
- You may want to audit or clean up inactive accounts
- Or you might be prepping to create, modify, or delete users
And it all starts with listing what’s already there.
Understanding Linux User Accounts
Every user account on a Linux system is stored in the /etc/passwd
file. It includes important info like:
- Username
- User ID (UID)
- Group ID (GID)
- Home directory
- Shell
There are two main types of accounts:
- System Users: Created by the OS or software packages; usually have UID < 1000
- Normal Users: Created by you or an admin; usually start at UID 1000 and above
Best Ways to List Users on Linux (From Beginner to Expert)
1. Use the cat /etc/passwd
Command
This is the classic method.
bash
cat /etc/passwd
Each line = one user. It’s a lot of info, but all the accounts are there.
2. List Only Usernames (No Extra Info)
If you only care about the usernames:
bash
cut -d: -f1 /etc/passwd
Or, using awk
:
bash
awk -F: '{ print $1 }' /etc/passwd
Super helpful when scripting or doing quick checks.
3. Use getent passwd
for Local + Remote Users
If you’re in an environment with LDAP or NIS authentication, this pulls users from both local and network databases:
bash
getent passwd
It’s a more complete, centralized list—perfect for sysadmins.
4. Count Users on Your System
Want to see how many user accounts exist?
bash
wc -l /etc/passwd
This counts the number of lines (users) in the file.
5. List All Users with UID ≥ 1000 (i.e., Human Users)
This is super useful if you want to see only real user accounts, not system-created ones.
bash
awk -F: '$3>=1000 { print $1 }' /etc/passwd
6. See Who’s Logged in Right Now
Sometimes, it’s not about who exists—it’s about who’s active:
bash
who
or
bash
w
Both commands show currently logged-in users and their session details.
7. Check Login History
To see who logged in and when:
bash
last
This pulls from /var/log/wtmp and shows login/logout history. It’s a great auditing tool.
8. Use compgen
to List Users (Bonus Method)
Here’s one you might not know:
bash
compgen -u
This lists all usernames recognized by your current shell. Handy and super fast.
Bonus: View User Home Directories & Shells
Want more than just the name? Try this:
bash
awk -F: '{ print $1 ": " $6 ", Shell: " $7 }' /etc/passwd
It shows usernames along with their home directories and default shells—useful when managing login environments.
FAQs About Listing Users in Linux
Q1: How can I list only active users on Linux?
Use who
or w
to see currently logged-in sessions. These show real-time usage, not just account presence.
Q2: How do I check if a specific user exists?
Use:
bash
id username
If the user exists, you’ll see UID/GID info. If not, you’ll get a “no such user” message.
Q3: Where are users stored in Linux?
All user data is stored in the /etc/passwd file. This is the master list of accounts on your Linux system.
Q4: How do I list system vs regular users separately?
Use UID filtering. System users typically have UID < 1000:
bash
awk -F: '$3<1000 { print $1 }' /etc/passwd
Normal users:
bash
awk -F: '$3>=1000 { print $1 }' /etc/passwd
Q5: Can I automate user listing in a script?
Yes! Combine these commands in bash scripts to automate user audits, daily login reports, or permission checks.
Final Thoughts
Learning how to list users in Linux is one of those little things that unlocks big power. It helps you stay in control, improve security, and better understand your server’s structure.
Whether you’re cleaning up old accounts, onboarding a new team, or building automation—these Linux user listing commands are your go-to toolkit.