lsgrp

2022-07-15 12:40 UTC
  • Xyne

Metadata

Description: A simple command-line utility to list all members of a group.
Latest Version: 2013.2
Source Code: src/
Architecture:
  • i686
  • x86_64
Arch Repositories:
  • [xyne-i686]
  • [xyne-x86_64]
AUR Page: lsgrp
Arch Forum Thread: 137708
Tags:

About

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..

Why is this necessary?

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.

Help Message

$ lsgrp -h

ABOUT
  lsgrp - list all members of a group

USAGE
  lsgrp <group name>
  lsgrp -h

OPTIONS
  -h: display this message and exit
Contact
echo xyne.archlinux.org | sed 's/\./@/'
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0