I want to check which directories take most disk space, quickly.
I tried du -sh subdir
but it took more than 20 seconds on bigger directories.
I'm not sure how to display the size of all the subdirectories in the home directory at once with this method, but I'm afraid that it might take minutes…
Is there a fast way to do this?
I don't need to display the size of files, just directories.
Best Answer
Sample directory
To find sizes only for folders, excluding hidden folders:
If you need a total at the end as well:
To sort the results:
To reverse the sorting order:
If you need with hidden directories as well, remove
-name '[!.]*'
from find command. I don't know any other command to find size of folders that is faster thandu
. Usedf
forfile system disk space usage
Use
find -maxdepth 1 -type d -name '[!.]*' -exec du -sh {} +
to avoid sub-folders showing up