Quantcast
Channel: Indrayan's SOA Blog
Viewing all articles
Browse latest Browse all 62

Unix Disk usage folderwise

$
0
0
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:


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

ii)du -sk $FILE_PATH/*|sort –n

This will sort the list based on file size

iii)du -sk $FILE_PATH /*|sort -n|awk '{print $2}'))

This will just pick the the second elements of each row (which is the file/folder name) inascending manner of their respective sizes.

iv)du -sh $(echo $(du -sk $FILE_PATH/*|sort -n|awk '{print $2}'))

This will display the file/folder sizes in Human understandable format in sequential format based on their sizes.


Viewing all articles
Browse latest Browse all 62

Trending Articles