Below given script will give the disk usage against each folder/files under any directory in a ascending manner.
du -sh $(echo $(du -sk $FILE_PATH/*|sort -n|awk '{print $2}'))
eg : du -sh $(echo $(du -sk /aiaapp/oracle/product/10.1.3.1/OracleAS/*|sort -n|awk '{print $2}'))
This will give a output result as given below:
![]()
du -sh $(echo $(du -sk $FILE_PATH/*|sort -n|awk '{print $2}'))
eg : du -sh $(echo $(du -sk /aiaapp/oracle/product/10.1.3.1/OracleAS/*|sort -n|awk '{print $2}'))
This will give a output result as given below:
Below given is the step by step understanding & processing logic of script :
i)du -sk $FILE_PATH/*
This will give the details of all folders/files & their sizes directly under $FILE_PATH
This will sort the list based on file size
This will just pick the the second elements of each row (which is the file/folder name) inascending manner of their respective sizes.
This will display the file/folder sizes in Human understandable format in sequential format based on their sizes.