Groups viewing the members of the currently logged on user group
Groups Gliethttp View the group that the Gliethttp user is in, and the members in the group
WHOAMI View the currently logged in user name
Information about groups within the system is placed in the/etc/group file, and the user's information is placed in the/etc/passwd file. Now I want to see all the users in a group named "Plants". First, you know the ID of the group, the GID. Use the command:
' Plants ' /etc/group
The result is: plants:x:1003 the GID is 1003 (this group 1003 on my computer, other computers may be other numbers). Then find the user in/etc/passwd that the group number is 1003. You can first use CAT/ETC/PASSWD to look at this file, found that the fourth column is GID (two columns between ":" separate). Next, enter:
Awk-f":"'{print $ ' \t\t ' $4}'1003'
":" means ":" As the delimiter (/etc/passwd ":" As the delimiter), print print, and $4 for the first and fourth columns, and the user name and group number; \ t for tabs; grep ' 1003 ' indicates that the row containing 1003 is fetched.
In this way, all users within a group can be displayed.
Transferred from: http://www.2cto.com/os/201211/165118.html
Linux commands-All users under a user group