code: public static String getGroupName(long gid) throws IOException {
      if (OSUtils.isLinux()) {
        String script = "getent group " + gid + " | cut -d: -f1";
        return ShellUtils.execCommand("bash", "-c", script).trim();
      } else if (OSUtils.isMacOS()) {
        String script = "dscl . list /Groups PrimaryGroupID | awk '($2 == \""
            + gid + "\") { print $1 }'";
        return ShellUtils.execCommand("bash", "-c", script).trim();
      }
      return "";
    }
docs: Gets the group name from the group id.
  
  @param gid the group id
  @return group name