RackNerd Billboard Banner

How to List All User Groups on Linux

If you’re managing a Linux system, keeping track of user groups is essential. Groups define permissions, control access to files, and help you manage user privileges efficiently. Whether you’re a system administrator or just a curious user, knowing how to list all groups—and the groups a user belongs to—can save you time and prevent headaches.

Here’s how to do it.

List All Groups on the System

Every group on your Linux system is defined in the /etc/group file. To see all groups, you can use a simple command:

cat /etc/group

This will display every group along with its details. If you just want the names, not all the extra info, use:

cut -d: -f1 /etc/group

This command “cuts” out only the group names for an easy-to-read list.

List Groups for a Specific User

Want to see what groups a particular user belongs to? Try:

groups username

Replace username with the actual user’s name. If you want to check your own groups, just type:

groups

Another handy command is:

id username

This gives you the user’s UID, primary group, and all their secondary groups.

Example Output

Here’s what you might see when listing all groups:

root
daemon
bin
sys
adm
sudo
users

And for a specific user:

$ groups john
john : john sudo users

Why Does This Matter?

Groups make it easier to manage permissions. Instead of setting permissions for every user, you can assign users to groups and set permissions for the group. It’s faster, safer, and less prone to mistakes.

Quick Recap

  • List all groups:
    cut -d: -f1 /etc/group
  • List groups for a user:
    groups username
  • Check your own groups:
    groups
  • See detailed info:
    id username

Mastering these commands helps you stay organized and secure on Linux. Keep them handy for daily use or troubleshooting.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
© 2025 Computer Everywhere
Your Everyday Guide to the Digital World.
Terms of Service | Privacy Policy
Copy link