Average and maximum size of directories
I have a directory and a bunch of sub-directories like this: - directory1 ( sub-dir1 , sub-dir2 , sub-dir3 , sub-dir4 , sub-dir5 ...........and so on, hundreds of them...) How do I find out what is average size of the sub-directories? And how do I find what is the maximum size of the sub-directories? All using Unix commands... Thanks. If you only have directories and not files in directory1 , then the following two "commands" should give you the size (in bytes) and name of the largest directory and the average of their sizes (in bytes), respectively. $ du -sb directory1/* | sort -n | tail -n 1