Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

If I try

du -s -h -x /*

it will try to examine all filesystems (real and pseudo) mounted directly under /, e.g. /dev, /proc, /sys, /run, and /home (/home is on an extra partition).

I think it comes from the shell expansion of *, giving du a parameter list that explicitly includes these mount points.

Is there a way to make du not examine mounted filesystems, even when the mount points are contained in the parameter list ?

I really don't want to type all subdirs of / just to avoid them being in the parameter list.

share|improve this question
up vote 2 down vote accepted

You can still filter that using mountpoint (if available on your system):

for a in /*; do mountpoint -q -- "$a" || du -s -h -x "$a"; done

If mountpoint is not available but stat is (while stat is still not POSIX, it may be more common), you will have to compare the stat output manually:

rootdevice="$(stat -c %D /)"
for a in /*; do [ "$rootdevice" = "$(stat -c %D -- "$a")" ] && du -s -h -x "$a"; done
share|improve this answer

I guess you're right. You are actually saying du /dev, du /sys, du /usr, du /home so the "-x" option is meaningless.

Why don't you loop over it? E.g. find / -maxdepth 1 | egrep -v home|media will list all dirs except home and media. Then you can pipe the output to a while loop to du it.

find / -maxdepth 1 | egrep -v home|media | while read f; do
  du -s -h -x "$f"; 
share|improve this answer
I would also need to manually type the egrep'ed exclusion list, as it's not only home and media. Looking again at my /, it's nearly 1/3 to exclude. Yes, it's better than typing 2/3 to include, but still something I do not like to type in. ;-) – Markus N. Aug 31 '13 at 11:11

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.