Determine the Directory Size Recursively

On November 19, 2008, in Directory Size, by Dipin Krishna

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 Reply

*

Search