Determine the Directory Size Recursively

Sometimes you want to ascertain the space hogs on your system. You might have noticed that a certain top level directory is larger than usual, but you are unsure what subdirectory or subdirectories are the culprits.

Here’s an example of what can be done:

#cd /huge_directory
#du -k . (current directory size given in kilobytes)

To find the sizes recursively (subdirectories):

#cd /huge_directory
#sh
#for size in ‘ls’
do
du -k $size
echo $size done
done


Leave a comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.