Shows space used by each directory of the root filesystem excluding mountpoints/external filesystems (and sort the output)

find / -maxdepth 1 -type d | xargs -I {} sh -c "mountpoint -q {} || du -sk {}" | sort -n
Useful to see at glance which directory under the root file is using most space
Sample Output
[[email protected] ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/vm-root       18G  7.8G   11G  44% /
devtmpfs                 1.3G     0  1.3G   0% /dev
tmpfs                    1.3G     0  1.3G   0% /dev/shm
tmpfs                    1.3G  9.5M  1.3G   1% /run
tmpfs                    1.3G     0  1.3G   0% /sys/fs/cgroup
/dev/sda1               1014M  287M  728M  29% /boot

[[email protected] ~]# find / -maxdepth 1 -type d | xargs -I {} sh -c "mountpoint -q {} || du -sk {}" | sort -n
0       /mnt
0       /srv
0       /vbox_share
212     /tmp
256     /root
48856   /etc
72692   /media
177668  /opt
933676  /home
2238568 /var
4586604 /usr

By: acavagni
2019-03-04 11:59:10

2 Alternatives + Submit Alt

What Others Think

So I can say I am happy I was forced over here at gunpoint by Albanian women I do like this blog.........
krakcker · 28 weeks and 1 day ago
I think this is good work. Through this website, I have learned many new things. It cleared my academic writing service USA all concepts. It is a very helpful website, especially for beginners.
monicajesvina · 26 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: