Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

Etc.getgrgid

(?::Integer group_id) -> ::Etc::Group
getgrgid(group_id) → Etc::Group

Returns information about the group with specified integer group_id, as found in /etc/group.

The information is returned as a Group struct.

See the unix manpage for getgrgid(3) for more detail.

Example:

Example
Etc.getgrgid(100)
#=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
See also .getgrent .getgrnam .endpwent .getlogin also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0