Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Mac OS X Lion, given a group's GeneratedUID, what command can I do a reverse lookup and find the group name? DSeditgroup (group name) will give me the GUID, but I'm looking for the reverse.

Thank you in advance.

share|improve this question

Take a look at the getgrnam() or getgrgid() C functions included in Mac OS X.

See the getgrent manual page.

man getgrent

Also here is an example that needs some work, but something along these lines should allow given a GID number, lookup and print the group name.

#include <stdio.h>
#include <grp.h>

int main()
    struct group myGroup;

    struct group *grp;

    grp = &myGroup;

    grp = getgrgid(20); // <--- Enter your group ID number

    if (grp == NULL)
        printf("Something went wrong\n");

    printf("Group Name is: %s\n", myGroup.gr_name);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.