Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.3: See a quick view of folder-by-folder disk utilization' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: See a quick view of folder-by-folder disk utilization
Authored by: eduo on Oct 25, '03 03:24:43AM

It's even better if you add a piped command for sorting.

du -ks * | sort -rin

That'll sort the listing from highest disk space to lowest, including the totals of disks.

The -h parameters is a nice touch for shorter listings, but this is a better way to find the biggest culprits around. I've been using this for over 6 years and it's one of the commands I use the most when pruning. I took it out because then the sorting loses a little bit of sense.

It's still useful as long as you remember it's sorting alphabetically, which means all "K" will be together, all "M" will be together and all "G" will be together, sorted within their own group.

Lastly, you could do:

du -ks * | sort -rin | head -n 20

To see the top 20 disk hoggers in your directory. I used this a lot when I was working in an ISP 4 years ago to see what users where using up too much disk space..:)


[ Reply to This | # ]
10.3: See a quick view of folder-by-folder disk utilization
Authored by: eduo on Oct 25, '03 03:49:17AM

That was the geeky response, I feel forced to give also the no-brain comment to this hint.

This is easily doable in the Finder as well, which may be overlooked when we're trying to find new things to do around.

You can do this simply switching to "list" mode and enabling "Calculate all sizes" in the Info Options window (command-J). I have this enabled for list sizes in all Windows, as it's so practical.

You switch to list view, you enable "Calculate Sizes" and you can click on the "Size" column header to sort by that parameter. This is especially useful because you can expand the folders (click on the triangle) and the contents will appear sorted as well, so you could in a single window list your whole home directory, see you have 15GB in your "Movies" folder, expand that in the same window and see that you haven't deleted the iMovie project you did two years ago of your cousin's wedding (can you tell this is a real-life experience?..:)

(BTW, this is one of the beautiful functionalities you may miss if you always use Column View, something I will never get accustomed to, it seems, as it's a view optimized for fast navigation, not fast manipulation of files)


PS: It's still a good hint as the text version works in terminal even in remote machines and, coupled with sudo, works as well for every directory in the system, while the paragraph above works only in the local machine.

PS2: I could've posted this hint a long time ago. I still can't realize when something I might've been using for years may be of value to others..:)


[ Reply to This | # ]