Use this simple command to find large directories. To find directories over 1GB
[root@localhost]# du -h / | grep ^[0-9.]*G
or
[root@localhost]#find / -type d -size +1G (This one was provided in a comment by Emme)
Click to play tutorial:
To find directories over 10GB and sort the output with the largest directories on top
[root@localhost]# du -h / | grep ^[1-9][0-9][0-9.]*G | sort -rn
To find directories over 200GB
[root@localhost]# du -h / | grep ^[2-9][0-9][0-9][0-9.]*G
| du – h | Lists directory sizes in human readable format |
| / | Tells the du command to search the / (root) directory. It could easily be another directory such as /home/ or /var/log/ |
| | | The | or pipe symbol sends the output of the “du -h /” command to the following command. |
| grep | Grep searches through the output looking for strings matching the following regular expression. |
| ^[1-9][0-9][0-9.]*G | A regular expression^ Represents the start of the string
[1-9] Represents digits 1-9 [0-9] Represents digits 0-9 [0-9.] Represents digits 0-9 or . (the “dot” character is a special * Represents the previous expression ([0-9.]) Zero or more times. G Represents the capital letter G. When du outputs data in human |
| | | The Pipe symbol again. This time it is used to send output to the sort command. |
| sort -rn | This command sorts the output from the other commands with the largest directories on top. |

July 31st, 2007 at 3:10 pm
Hello! Good Site! Thanks you! cywwuykwizpe
June 16th, 2008 at 10:12 am
Thanks for this! I was looking for an easy way to pick out the largest directories to see where all my space had gone. Glad I found this post.
September 25th, 2008 at 10:06 am
your idea is good, but it would skip a directory that is 1 TB large
Ciao,
Emme
September 25th, 2008 at 10:08 am
You should try with find:
# find / -type d -size +1G
September 25th, 2008 at 12:29 pm
emme,
Good point and thanks for sharing another way!
Josh
October 7th, 2008 at 6:33 pm
Hi!
I want to improve my SQL experience.
I red that many SQL resources and would like to
read more about SQL for my position as mysql database manager.
What can you recommend?
Thanks,
Werutz
October 21st, 2008 at 3:12 pm
Thnx very interesting.
December 19th, 2008 at 12:08 am
Hello
As a fresh http://www.blindhog.net user i just wanted to say hi to everyone else who uses this board <:-)
March 17th, 2009 at 4:18 pm
exactly what I was looking for… Didn’t actually know there was a -h option for du.
Thanks!
April 21st, 2009 at 6:22 pm
Hello Everyone
I just became a member of this forum
Great work forum crew!
Just recently I read that there is a cure for diabetes on http://www.healthcaredaily.org
Is this way of curing diabetes mentioned actually true, If so I should have found out earlier! The source looks like a reliable healthcare news website
Has anyone tried beating diabetes this way?
Thanks a lot
Arcappyfify
August 31st, 2009 at 7:14 am
Great post, very helpful! I pushed this to its logical conclusion and made what I’ve found to be a useful alias:
alias largedirs=”sudo du -h $PWD 2>&1 | grep -v ‘cannot access’ | grep ^[1-9]*G | sort -rn”
This searches in the current directory for dirs 1GB or more in size and filters out error messages related to process files.
August 6th, 2010 at 6:37 am
# find . -type d -size +1G
find: invalid -size type `G’
i cant use ls -l or du cmds , as i have over 85k directories in that a particular location. Any other option ?
August 7th, 2010 at 12:43 pm
The du command described in this article have always worked for me. But, then again…i’ve never tried 70k directories either.
Josh