script for finding all the users with GID 0 ( admin group )

Hi Friends,

I am trying to write a script for finding all the users with the GID 0 i.e. Admin users. can you please help me on this.

For just having a glance at it:

sort -t":" -nr -k3,3 /etc/passwd

The users with gid 0 will be listed at the bottom. To reverse remove the -r.

For further usage of the output you might want something like:

awk -F":" '$3 == 0 {print}' /etc/passwd

This is no AIX specific topic so next time post in the subforum for Shell Scripting please, ty.