sudo groups $USER
показывает, что юзер состоит в группе example
sudo groups example
пишет groups: ‘example’: no such user
NAME
groups - print the groups a user is in
SYNOPSIS
groups [OPTION]... [USERNAME]...
DESCRIPTION
Print group memberships for each USERNAME or, if no USERNAME is specified,
for the current process (which may differ if the groups database has changed).
‘example’: no such user
groupmems -g $GROUP -l
.