ThorstenS's method seems like more work then is needed to me because it runs find multiple times. For a one off, I would just do 1 find command, and output the owner and size of each file, and then do some sort magic on that file.
The find would be something like which returns username (or id number of no username) and space used in bytes, in a null-byte delimited file:
sudo bash -c 'find . -printf "%u\0%s\0" > username_usage'
You can replace the \0
with something that might be a little bit easier to work with, like tabs or newlines, but that would be less safe if you have funky file names.
If you wanted to be even more efficient, you could pipe the output to script that handles it as it runs, but that would be a little more work, and you would have to get it right the first time.