Currently, there is no command to query a team member directly based on the group name in Linux.
There are two ways that the system provides a way to find relationships between group members and groups.
One is to find the/etc/passwd and/etc/group directories, and find the members within the group in/ETC/PASSWD based on the ID of the group in the/etc/group directory.
The other is: through the groups command, according to team members to find the group belongs to
I use the grep and cut commands to find out the function of the group member through the name of the team, the command is as follows
# gid= ' grep ' group name '/etc/group | Cut-d ': '-f 3 ' && grep '. *:x:[0-9]*: $gid "/etc/passwd |cut-d ': '-F 1
Description
This sequence of commands is separated by && (&&: The command of the current polygon is correct, the subsequent command executes)
&& Previous command: First, according to the group name with grep from the/etc/group query out the group name which line of information, and then use the Pipeline command cut detect GID, then the GID assigned to the variable.
&& after a paragraph of command: first in grep through the "regular match plus gid" from the/etc/passwd to find out the group of each member of the information (a behavior of a member), and then cut the user name "cut" out.
Linux queries all members within the group based on the group name