Is there a Terminal command that will list the current admin account?

Solution 1:

Users who have administrative privileges on OS X belong to the group admin. There's no straight forward way to list members of a group as OS X uses Open Directory to manage these things and it's a bit convoluted as a result.

Here is a shell function that will give you all the members of a group. It was taken from this SuperUser.com Q&A:

members () {
  dscl . -list /Users | while read user; do
    printf "$user "
    dsmemberutil checkmembership -U "$user" -G "$*"
  done | grep "is a member" | cut -d " " -f 1;
};

Save that in your ~/.bash_profile or just cut and paste it to a bash or zsh prompt and then you can run:

members admin

and you'll get a list of accounts that have administrator privileges on the machine.