getting rid of excess groups

Tom H tomh0665 at gmail.com
Sun May 12 20:21:33 UTC 2013


On Sun, May 12, 2013 at 8:35 AM, John R. Sowden
<jsowden at americansentry.net> wrote:
>
> I seem to have groups for staff, me, another user, and others above and
> below 1000. I would like to get rid of the ones not used, but I need to
> know if they are used. How do I do this?
> Not only are they used by a program, but also are there files owned by those
> groups?

You should read

/usr/share/doc/base-passwd/README
/usr/share/doc/base-passwd/users-and-groups.txt.gz

before deleting any system groups.

You can use

for G in $(awk -F: '!/root/ {print $1}' < /etc/group) ; do find /
-xdev -group "$G" ; done

but it'll run find for every group on your system other than "root",
so you might want to copy "/etc/group" to another file and edit some
lines out - or "feed" the find command some other way.

(Re-run the command if "/usr" or /var" or "..." is a separate filesystem.)




More information about the ubuntu-users mailing list