Deleting Groups with groupdel

If you need to delete a group or groups, and you want to be sure there are no orphaned files or users, first reassign the group members, if necessary, by editing /etc/group. Simply copy and paste them into another group. Then use groupdel to delete the group, and find and chgrp to locate and reassign the group’s files to another group.

To delete a group use:

# groupdel

Deleting a group tends to be messy, because there is no utility for automatically migrating or deleting any files or users belonging to the group. You’ll need to hunt these down and change the GIDs manually:

# find / -gid 750

You can change these one at a time:

# chgrp 800 /usr/src/include/lber.h

Or you can let find and chgrp do the work:

# find / -gid 750 -exec chgrp -v 800 { } \;