Find users that use the most disk space

Apr 11, '13 07:30:00AM

Contributed by: mematron

Find which users take up the most disk space. This can of course be used to indentify any number of users so I picked 10 as an arbitrary number.

If you are already root (unlikely, but possible) you can remove the sudo -s part. Here's the command:

sudo -s du -sm /Users/* | sort -nr | head -n 10
Generally you would have to make sure that you use sudo -s or it will give a few Permission denied errors before finally spitting out the results, and they may be incorrect. The directory structure should start with the /Users Directory and then it will recursively perform the operation. This may miss any folders outside of the normal user space, but there shouldn't normally be any user data there.

[crarko adds: I tested this, and it works as described. There are third party utilities that will give the same results with a GUI, but this is pretty handy to have for use on remote machines over an ssh connection. It can take a while to complete, so be patient. Also I noticed in Activity Monitor the du process was using a lot of cpu, so it's best to do this while not running other cpu (or I suppose disk) intensive programs.]

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20130404072518701