[PLUG] count files owned by each uid

Robert Citek robert.citek at gmail.com
Fri Dec 15 21:18:10 UTC 2017


On Fri, Dec 15, 2017 at 12:52 PM, Galen Seitz <galens at seitzassoc.com> wrote:
> find / -path /tmp -prune -o -path /sys -prune -o -path /proc -prune -o -printf %u:%g\\n | awk '{usergroup[$0]++}; END {for(key in usergroup) printf "%-20s %d\n",key,usergroup[key]}'

You could also limit find to the filesystems that you want by using -xdev:

find / /var /home -xdev ...

You also may want to capture the data to a file (e.g.
/dev/shm/file.ug.txt).  That way you can select/filter/transform the
dataset without having to traverse the filesystems again.

Regards,
- Robert



More information about the PLUG mailing list