How to list all of a users groups in Ubuntu

If you need to see all of the groups assigned to a user simply type the following into the Terminal:

groups username

To display all the groups on your Ubuntu system just type:

groups

 


Jonathan Whiting

I help people build better web apps and make a difference in the world. I enjoy sharing what I am learning and find interesting. I live on the Left Coast of Canada with my wife. Follow me on Twitter.


Comments

  1. The above is partially incorrect. “groups” entered on its own on the command line only shows the groups to which the current process belongs. To list all groups on the system, try:

    cat /etc/group

    • Jonathan Whiting

      Thanks Scott

    • /etc/group will give you the groups on the system BUT does not contain ALL information pertaining to which users are associated to which groups. It doesn’t contain the information around a user’s primary group. So if my user nevyn has a primary group of “finance”, you won’t find nevyn listed next to finance in /etc/group. Instead, this information is stored in /etc/passwd.

What do you think?

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>