Bash - list specific user groups in Linux

2 points
Created by:

In this short article we would like to show how to list any user groups in Linux Command Line.

Quick solution:

groups user_name

Note: by typing as second agrument user_name we indicate for what user we want to list assigned groups.

Practical example

Type following command:

groups john


john : john sudo cdrom

Explanation: we run command on Debian Linux, indicating as first argument john user, and he was assigned to john, sudo and cdrom groups.


User groups in Linux displayed in Bash.
User groups in Linux displayed in Bash.
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.