February 3, 2021 in Tutorial2 minutes
In this tutorial we learn how to use groups command in Linux. groups command print the groups a user is in. This command is similar to id command for groups.
groups [OPTION]... [USERNAME]...To get the list of groups where the current user is in we can run groups command without options.
groupsTo get the groups of a specific user, we can pass the username to groups command.
groups usernameWe can use man and info command to see the manual page of groups command.
groups command also have --help option to show list of options.
To open man page for groups command we can use command below. To exit man or info page you can press q.
man groupsTo open info page for groups command we can use command below.
info groupsTo open help page from groups command we can run command below.
groups --helpYou can find groups command source code from the folowing repositories:
You can read tutorials of related Linux commands below:
In this tutorial we learn how to use groups in Linux with practical examples. Visit our Linux Commands guide to learn more about using command line interface in Linux.