Linux: Find Out The Groups A User Is In

To find out which groups a user is a member of in Linux, you can use the groups command. The syntax is as follows:

groups <username>

Replace <username> with the username of the user you want to check. For example, to check the groups for the user “john”, you would run:

groups john

This will display a list of all the groups that the user “john” is a member of. For example:

john : john adm cdrom sudo dip plugdev lpadmin sambashare

In this example, the user “john” is a member of the following groups:

  • john
  • adm
  • cdrom
  • sudo
  • dip
  • plugdev
  • lpadmin
  • sambashare

Each group name is separated by a space. The user’s primary group is listed first, followed by any additional groups the user is a member of.

By using the groups command, you can easily find out which groups a user is in on a Linux system.

Leave a Comment