any quicker way to list disc usage by users?

Hi:

it takes a long time for "du -sh list_of_users" to give you the output.

Is there a quicker way to get this info?

Thanks!

N.B. Phil

du -sh list - I'm assuming list is a list of directories in someplace like /home where the username is the home directory.

du has to find the directory, then stat the files in the directory. It is doing this over and over for each "username" in the list.

One pass thru the whole directory tree is faster. Play around with this:

find /path/to/home  -exec ls -ls {} \ ; |
awk '{arr[$3]+=$1; next; }
       END {for (i in arr) {print i, arr}  }'
1 Like

Another method, I guess, would be to enable quotas on the filesystem you want to check. Then a running tally of each user's data usage is always available.

Thank you very much. I tried it but found the improvement is not very substantial.

when I time the du command, I found the (utime + stime)/real time is only 3%.

is there a way to make this ratio substantically higher?

Thanks.

Faster disks. That's where the real slowdown is.