You can use any one of the following command to list a groups a user belongs to:
a) id command – Display real and effective user and group IDs.
b) groups command – Display the groups a user is in on Ubuntu Linux.
Ubuntu: See which groups your Linux user belongs to
Open the Terminal app or login to the remote server over the ssh based session. Type the following id command
$ id -Gn
To display the groups a user named ‘tom’ is in on Ubuntu Linux, enter:
$ id -Gn tom
You can also use deprecated groups command as follows:
$ groups
$ groups tom
Sample outputs:
See also
- Linux / Unix: groups Command Examples
- Linux / Unix: id Command Examples
- Man pages – groups(1),id(1)