
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com
Mobile version of this page
Previous:
Happy Birthday to me!
Next:
Thuas Trägubbar
chmod files differently to directories
Happy Birthday to me!
Next:
Thuas Trägubbar
Related blogs
Linux tip: du --max-depth=1chmod files differently to directories
Related by category
Find largest directories with du -k
29th of December 2006
Here's a nifty little command I used today to find where my hard drive was being most used:
du -k /home/peterbe/Documents/ | sort -n | tail -10
I'm sure there are even fancier methods and programs but this works pretty damn well. Here's what the output can look like:
root@trillian:~ # du -k /home/peterbe/Documents/ | sort -n | tail -10 4240 /home/peterbe/Documents/Kalle 4852 /home/peterbe/Documents/ChartDirector/lib 7756 /home/peterbe/Documents/ChartDirector/doc/cdpydoc 7764 /home/peterbe/Documents/ChartDirector/doc 13044 /home/peterbe/Documents/*** FONT _ ***/- Font Applications - 14704 /home/peterbe/Documents/ChartDirector 547940 /home/peterbe/Documents/*** FONT _ *** 2171000 /home/peterbe/Documents/MacOSXSoftware/Adobe Creative Suite 2 Premium 3262580 /home/peterbe/Documents/MacOSXSoftware 5694808 /home/peterbe/Documents/
Comment
Anonymous -
10th March 2010
[«« Reply to this]
Thanks, I was looking for a quick copy/paste blog entry to help me find the largest directories on my 4G compact flash that runs as "SSD".
Since the laptop is quite slow and low on memory, I altered your line a bit:
du -h /|grep M|sort -nr|head -15
du -h to have readable output
grep M to prevent sorting large numbersK
head instead of tail so that it doesn't have sort more than necessary
sort -r to reverse the order for head
Thanks, I was looking for a quick copy/paste blog entry to help me find the largest directories on my 4G compact flash that runs as "SSD".
Since the laptop is quite slow and low on memory, I altered your line a bit:
du -h /|grep M|sort -nr|head -15
du -h to have readable output
grep M to prevent sorting large numbersK
head instead of tail so that it doesn't have sort more than necessary
sort -r to reverse the order for head
Marc Wolsiffer -
31st March 2010
[«« Reply to this]
du -h | sort -nr| grep [0-9]M | head -20
added [0-9] helps a ton to sort out, thanks for everyones posts!
du -h | sort -nr| grep [0-9]M | head -20
added [0-9] helps a ton to sort out, thanks for everyones posts!


Quite useful.
Even more useful is GDMap: http://gdmap.sourceforge.net/
Cute way of visualizing disk usage. You can identify large folders and files almost instantly.