Re: [PLUG] count files owned by each uid

2017-12-15 Thread Galen Seitz
On 12/15/17 11:55, Galen Seitz wrote:
> Hi,
> 
> Can anyone suggest a quick way to get a count of the number files owned
> by each uid, or alternatively, print each unique uid that exists in the
> filesystem?  Bonus points for doing the same thing for gid's in the same
> pass.

Thanks for the other suggestion.

I finally used the correct search terms and found what I wanted.  I'm
running this now, but it's taking a while.

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]}'

Next time I will probably add "-uid +499", as I'm not interested in
system accounts.


galen
-- 
Galen Seitz
gal...@seitzassoc.com
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] count files owned by each uid

2017-12-15 Thread Paul Heinlein

On Fri, 15 Dec 2017, Galen Seitz wrote:


Hi,

Can anyone suggest a quick way to get a count of the number files 
owned by each uid, or alternatively, print each unique uid that 
exists in the filesystem?  Bonus points for doing the same thing for 
gid's in the same pass.


Quickly? Probably not. I suppose there's a quota scheme that might 
keep track of such data, but I've never really investigated it.


Less quickly:

sudo find / -type f -exec stat -c '%u:%g' {} \; > /tmp/filedb.txt
# user file count
cut -d: -f1 /tmp/filedb.txt | sort | uniq -c
# group file count
cut -d: -f2 /tmp/filedb.txt | sort | uniq -c




thanks,
galen



--
Paul Heinlein
heinl...@madboa.com
45°38' N, 122°6' W___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] count files owned by each uid

2017-12-15 Thread Russell Senior
First knee jerk response is find.  Do you just want normal files?  or
other things too, like directories, devices, links, et al?

On Fri, Dec 15, 2017 at 11:55 AM, Galen Seitz  wrote:
> Hi,
>
> Can anyone suggest a quick way to get a count of the number files owned
> by each uid, or alternatively, print each unique uid that exists in the
> filesystem?  Bonus points for doing the same thing for gid's in the same
> pass.
>
> thanks,
> galen
> --
> Galen Seitz
> gal...@seitzassoc.com
> ___
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug