in reply to Re^2: How to get group ownership of a file
in thread How to get group ownership of a file

It can't be all numbers, right?

On the contrary (for unix-like systems, at least), the uid and gid are always numeric. To get the name (string) associated with a given numeric gid value, you need to grep for that number in /etc/groups (and to get the user login name for a given uid, you look up the uid in /etc/passwd).

  • Comment on Re^3: How to get group ownership of a file

Replies are listed 'Best First'.
Re^4: How to get group ownership of a file
by chargrill (Parson) on Feb 26, 2006 at 23:22 UTC

    Or this:

    perl -e '$groupname=getgrgid("33200");print "groupname: $groupname\n"'


    --chargrill
    $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
      And this for the username:
      perl -e '$username=getpwuid("33197");print "username: $username\n"'