Description: | A simple command-line utility to list all members of a group. |
Latest Version: | 2013.2 |
Source Code: | src/ |
Architecture: |
|
Arch Repositories: |
|
AUR Page: | lsgrp |
Arch Forum Thread: | 137708 |
Tags: |
lsgrp
is a very small, simple and fast utility written
in C. All it does is list the members of a group:
$ lsgrp users
foo
bar
bob
rms
santa
It is intended for use in system scripts that need to do something for each user in a group, such as setting up temporary home directories or creating per-user configuration files..
A user’s primary group is only listed in the passwd file, so to get a full list of group members, you have to check both the passwd file and the group file. The usual approach is to parse these files using grep, sed, cut, etc. That requires the invocation of subshells and it is prone to error, especially in cases where the set of user names intersects with the set of group names.
Before I wrote this, I searched for such a tool but all I found were various ways to parse those files using the standard commands. I expect that there is already something that does exactly this, but I was unable to find it.
$ lsgrp -h
ABOUT
lsgrp - list all members of a group
USAGE
lsgrp <group name>
lsgrp -h
OPTIONS
-h: display this message and exit