Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to help a specific user, say alice, free up some disk space; but not all the user's files are in his home directory; many are in directories shared with other users. I'd like to have something like the output of

du -sh *

but limited to the files that belong to that user only. I.e., something like,

du -sh --ignore-all-users-except=alice *

So, for example, if in the current directory there are three directories, a, b and c, I'd like to see output such as the following:

1.3G   a
416K   b
80K    c

meaning that alice is using 1.3G inside a, 416K inside b, and so on.

Is there any utility that can give me such information, or do I need a script?

share|improve this question
find / -user alice -print0 | du -ch --files0-from=-
share|improve this answer
Thanks. This is indeed good as a starting point. It misses -type f (otherwise it counts some files twice or more times if they are inside a directory owned by alice), and I also use tail -n 1. Actually the full command that does what I want is for x in *; do find $x -type f -user alice -print0 | du -ch --files0-from=-|tail -n 1|awk '{ printf "%-10s", $1 }'; echo $x; done – Antonis Christofides Jul 10 '13 at 9:50

I think this will do.

find . -user alice -type f -exec du -h {} +

Update: You might want to check the answers here

share|improve this answer
Neither the find command nor the linked post does what I want, as the first gives a huge list of files and the second concerns usage across the entire file system, whereas I want a sum per specific directories. – Antonis Christofides Jul 10 '13 at 10:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.